wx.chooseImage({
count:1,
success: function(res) {
var tempFilePaths = res.tempFilePaths;
wx.uploadFile({
url: app.globalData.requestHost+’/main/update_pic’,
filePath: tempFilePaths[0],
name: ‘icon’,
formData:{
‘client’: 1,
‘json_type’:1,
‘token’:app.globalData.token,
‘type’:‘create’,
‘user_id’:app.globalData.userId
},
success: function(res){
//sucess
},
fail:function(res){
console.log(res);
}
})
}
})