wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
that.setData({
avatarUrl: that.data.avatarUrl.concat(res.tempFilePaths[0])
})
wx.uploadFile({
url: app.globalData.apiurl + 'WxAPI/UpImgWx.ashx?type=2',
filePath: res.tempFilePaths[0],
name: 'images',
formData: {
},
success(res) {
console.log(that.data.res);
},
fail: function (res) {
console.log(res);
}
});
},
fail: function (res){
console.log(res);
}
})
然后就报 uploadFile:fail Error: socket hang up