使用wx.upload时,提示错误:
uploadFile:fail TypeError: Request path contains unescaped characters
代码:
wx.uploadFile({
url:'https://wbadmin.**-******.net/user/upload',
filePath:tempFilePaths[0],
name:'report',
header: {"content-type": "application/x-www-form-urlencoded"},
// formData: {}, // HTTP 请求中其他额外的 form data
success: function(res){
wx.showToast({
title:res.data.state,
icon:'success',
duration:2000
})
},
fail: function(res) {
console.log(res)
}
})
星号替换的部分是普通字母。
encode