🐘
upload_audio_ui.php
Back
📝 Php ⚡ Executable Ctrl+S: Save • Ctrl+R: Run • Ctrl+F: Find
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Upload Audio</title> <style> body { font-family: Arial; padding:20px; background:#f7f7f7; } .container { max-width:500px; margin:auto; background:white; padding:25px; border-radius:8px; } button { background:#2d6cdf; color:white; padding:10px; width:100%; border:none; margin-top:10px; } #result { margin-top:15px; font-weight:bold; } </style> </head> <body> <div class="container"> <h2>Upload Audio (MP3)</h2> <input type="file" id="audioFile" accept="audio/mp3,audio/mpeg"> <button onclick="uploadAudio()">Upload</button> <div id="result"></div> </div> <script> async function uploadAudio() { let f = document.getElementById("audioFile").files[0]; if (!f) return document.getElementById("result").textContent = "No file chosen"; let fd = new FormData(); fd.append("audio", f); let r = await fetch("upload_audio.php", { method: "POST", body: fd }); let j = await r.json(); document.getElementById("result").textContent = j.success ? "Uploaded: " + j.url : j.error; } </script> </body> </html>