- 当前 Bug 的表现:视频上传功能,安卓手机可以上传,换了IOS就一直上传失败
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
//上传视频
function uploadVideo(tempFilePath, callback) {
wx.showLoading({
title: ‘上传视频中’,
});
var token = wx.getStorageSync(‘token’);
uploadTask = wx.uploadFile({
url: root_url + ‘/upload/video?token=’ + token,
filePath: tempFilePath,
method:‘POST’,
name: ‘file’,
header: { ‘Content-Type’: ‘moultipart/form-data’ },
formData: {
‘token’: token
},
success: function (res) {
var data = JSON.parse(res.data);
if(data.success){
callback(data.data.id);
}else{
wx.showModal({
title: ‘视频上传错误’,
content: ‘错误:’ + res.data,
});
}
},
fail: function (res) {
wx.showModal({
title: ‘错误提示’,
content: ‘视频上传失败’,
showCancel: false,
})
},
complete: function (res) {
wx.hideLoading();
},
});
uploadTask.onProgressUpdate((res) => {
wx.hideLoading();
wx.showLoading({
title: res.progress+’%’,
});
})
}