报错信息:
VM6374:1 uploadFile:fail createUploadTask:fail Error: Invalid URL passed to App.getProxyForURL()’
upFileHandler () {
wx.chooseImage({
count: 1,
success (res) {
const tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: ‘’,
filePath: tempFilePaths[0],
name: ‘image’,
formData: {
‘imgIndex’: 0
},
header: {
“Content-Type”: “multipart/form-data”
},
success: function (res) {
var data = JSON.parse(res.data);
}
});
}
})
}
wx.chooseImage({ count: 1, success (res) {
wx.uploadFile({ url: '' , filePath: tempFilePaths[0], name: 'image' , formData: { 'imgIndex' : 0 }, header: { "Content-Type" : "multipart/form-data" }, success: function (res) { var data = JSON.parse(res.data); } }); } }) } |
整理一下格式,在调用这个方法时,就会报错
uploadFile:fail createUploadTask:fail Error: Invalid URL passed to App.getProxyForURL()' |