wx.chooseImage是获取图片,一个是 wx.uploadFile是上传图片
//选取图片
wx.chooseImage({
count: 1,
sizeType: ['original'],//原图
sourceType: [ 'album','camera'],//支持选取图片
success (res) {
// tempFilePath可以作为img标签的src属性显示图片
const tempFilePaths = res.tempFilePaths[0];
//上传图片
wx.uploadFile({
//请求后台的路径
url: 'http://192.168.35.201:8090/image',
//小程序本地的路径
filePath: tempFilePaths,
//后台获取我们图片的key
name: 'i