我有使用 Recorder.js 的简单 Record Wave 脚本现在问题是记录没问题减少到我的记录还可以从blob下载记录文件没问题上传记录文件(这里是问题)操作系统 ( windows 10 & appserv )我的上传.php <?php print $_FILES["audio_data"]["tmp_name"]; //this will print out the received name, temp name, type, size, etc. //check if upload folder exist or not if(!is_dir("uploads")){ $res = mkdir("uploads",0777); } $size = $_FILES['audio_data']['size']; //the size in bytes $input = $_FILES['audio_data']['tmp_name']; //temporary name that PHP gave to the uploaded file $output = $_FILES['audio_data']['name'].".wav"; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name move_uploaded_file($input, $output) ?>我的 js 文件的一部分function createDownloadLink(blob) { var url = URL.createObjectURL(blob); var au = document.createElement('audio'); var li = document.createElement('li'); var link = document.createElement('a'); //name of .wav file to use during upload and download (without extendion) var filename = new Date().toISOString(); //add controls to the <audio> element au.controls = true; au.src = url; //save to disk link link.href = url; link.download = filename+".wav"; //download forces the browser to donwload the file using the filename link.innerHTML = "Save to disk"; //add the new audio element to li li.appendChild(au); //add the filename to the li li.appendChild(document.createTextNode(filename+".wav ")) //add the save to disk link to li li.appendChild(link);
1 回答
呼唤远方
TA贡献1856条经验 获得超11个赞
您正在使用输出目录作为文件名,因此会引发错误。
由于您的上传目录是上传。
试着更新一下:
$output ="uploads/".$_FILES['audio_data']['name'].".wav";
- 1 回答
- 0 关注
- 77 浏览
添加回答
举报
0/150
提交
取消