小程序canvasToTempFilePath生成图片后,怎么上传到自己的服务器,不知道什么原因请求发送不出去 100
wx.canvasToTempFilePath({canvasId:'showImg',success:function(res){varpath=res.tempFil...
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){
}
})
}
}) 展开
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){
}
})
}
}) 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询