takePhoto后保存不了图片
Page({
data: {
tempurl: ‘’
},
takePhoto() {
const ctx = wx.createCameraContext()
ctx.takePhoto({
quality: ‘high’,
success: (res) => {
this.setData({
tempurl: res.tempImagePath
});
console.log(this.data.tempurl);
wx.uploadFile({
url: ‘https://。。。。/images/temp/’,//此处为上传的路径
filePath: this.data.tempurl,
name: ‘file’,
success: function (res) {
var data = res.data;
console.log(res.statusCode);
//do something
}
})
}
})
},
error(e) {
console.log(e.detail)
},
})
此为代码
用takePhoto拍照后返回了一个tempImagePath,用此路径可以在页面上展示出图片,没问题。但上传图片状态码返回403是为什么?
