小程序canvasToTempFilePath生成图片后,上传自己服务器,请求发送不出去是什么原因?

发布于 7 年前作者 tao608443 次浏览最后编辑 7 年前来自 ask

小程序canvasToTempFilePath生成图片后,怎么上传到自己的服务器,不知道什么原因请求发送不出去

wx.canvasToTempFilePath({
canvasId: 'showImg',
success: function (res) {
var path = res.tempFilePath;
wx.uploadFile({
url: 'https://***/upimg',
filePath: path,
name: 'file',
formData: {
'user': 'test'
},
header: { "Content-Type": "multipart/form-data", },
success: function (res) {
var data = res.data
console.log(res);
},
fail:function(res){
}
})
}
})
1 回复
xiaoguiying
xiaoguiying1 楼5 年前

没配置合法域名