移动端上传文件,用的是input的type='file' 上传,在大部分机型都是正常的,IOS也是正常,但是在OPPO R11无法上传,打印选择文件事件,发现在执行到去请求接口时,也请求了,但是后台接口没有接收到请求,目前只发现在OPPO R11上发现这个情况
相关代码
html 部分
<input type="file" accept="application/pdf, application/msword, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.wordprocessingml.document" id="file" @change="uploadfile($event,'file')"\>
js部分
/\*\*上传图片/文件 \*/
uploadfile(e, type) {
let el = this;
var file = e.target.files[0];
var data = newFormData();
data.append("file", file);
axios.defaults.headers["Content-Type"] = "multipart/form-data;charset=UTF-8";
axios.post(url, data)
.then(function(res) {
axios.defaults.headers["Content-Type"] ="application/json;charset=UTF-8";
if (res.data.Succeed) {
el.fileUrl = res.data.Data.thumbnailMd5;
el.sendFileImg(type, message);
} else {
el.$toast({
message:res.data.Message,
position:"bottom",
duration:3000
});
}
})
.catch(err=> {
axios.defaults.headers["Content-Type"] =
"application/json;charset=UTF-8";
});
}
现在是在OPPO R11上出现请求接口,后台没有接收到请求,其他机型正常,请教各位大佬
有没有等文件读取完成之后再上传?