已經(jīng)配置好了域名,wx.request能正確請求到,wx.uploadfile報域名不合法的錯誤。代碼如下:
wx.chooseImage({
success: function(res) {
var tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'https://www.riskall.cn/fastapply/CustomerAction.do',
filePath: tempFilePaths[0],
name: 'photo',
formData:{
'method': 'createFastApply4MicroPic'
},
method:'POST',
header: { "Content-Type": "multipart/form-data" },
success: function(res){
var data = res.data
console.log(data);
//do something
}
})
}
})