Skip to content

微信小程序——wx.uploadFile格式

微信小程序 | September 10, 2020


文章链接:https://blog.csdn.net/qq_43201350/article/details/108508874

如:以下是上传图片的一个格式

wx.uploadFile({
url: 'http://192.168.1.10:19001/aa/aa' + 'aa/aa/aa', // 接口地址
filePath: that.data.tempFilePaths[0], // 需要上传的数据
name: 'photoes', // 接口中参数名字
formData: { // 其它需要上传的数据(参数:数据)
userName: that.data.userName,
contactNum: that.data.contactNum, 
district: app.globalData.district,
},
header: {
"Content-Type": "multipart/form-data",
'access_token': wx.getStorageSync('token')
},
success (res){
const data = res.data
//do something
}
})