自从更新开发者工具之后,调用wx.uploadFile上传文件到本地服务,提示“appservice:21 uploadFile:fail createUploadTask:fail TypeError: Cannot read property ‘MaxUploadConcurrent’ of undefined”,旧版本的开发者工具能上传到本地http服务,
如果上传到服务器的https可以上传成功。
如果项目有输入APPID的话,勾选了不校验安全域名,证书。无论是https或者http都可以实现上传。
但是如果这个项目是无APPID的话,无论是https还是http,调用uploadfile接口,都会提示提示“appservice:21 uploadFile:fail createUploadTask:fail TypeError: Cannot read property ‘MaxUploadConcurrent’ of undefined”
uploadimage:function(e){
wx.chooseImage({
success: function (res) {
var tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: ‘https://192.168.1.103/Service1.svc/UpLoad’, //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: ‘file’,
formData: {
‘user’: ‘test’
},
success: function (res) {
console.log(res);
//do something
},
fail:function(error){
console.log(error);
}
})
}
});