小程序上传文件过程中,有时候成功,有时候报404以及500,报错信息如下:
代码如下:
var uploadTask = wx.uploadFile({
url: “https://www.test.com/api/resource/upload”,
filePath: resource[“image”][0],
name: “file”,
formData: {
“type”: 2
},
success: function(res) {
console.log(res);
},
fail: function(res) {
// console.log(res);
}
});
uploadTask.onProgressUpdate((res) => {
console.log(res);
});