<input type="file" id="ids" accept="audio/*" capture="microphone" @change="preview($event)"/>
这是用input调用手机录音功能的,
成功后获取到的路径是:blob:file:///2211e58e-4cc5-49d0-900f-fa129a57dd50
请问这种格式的录音路径需要转换吗?求高手帮忙看一下,感激不尽 谢谢
<input type="file" id="ids" accept="audio/*" capture="microphone" @change="preview($event)"/>
这是用input调用手机录音功能的,
成功后获取到的路径是:blob:file:///2211e58e-4cc5-49d0-900f-fa129a57dd50
请问这种格式的录音路径需要转换吗?求高手帮忙看一下,感激不尽 谢谢
使用FormDta
function preview(e) {
if(e.target.files.length === 0) {
alert('未选择文件');
return;
}
const file = e.target.files[0];
const xhr = new XMLHttpRequest();
xhr.open('POST','http://example.com/upload',true);
xhr.onload = function() {
// 上传完毕
console.log(xhr.responseText)
}
xhr.onerror = function(e) {
console.error(e);
}
const fd = new FormData();
fd.append("file",file);
xhr.send(fd)
}
13 回答12.8k 阅读
7 回答1.9k 阅读
5 回答1.4k 阅读
3 回答1.1k 阅读✓ 已解决
5 回答1.2k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
6 回答890 阅读✓ 已解决
参见如下内容。