大家好,
我现在有一个需求,就是在小程序中让可以手动签名,然后上传到服务器。我用 canvas 实现了在屏幕上签名,但是不会上传到服务器
用微信提供的 wx.uploadFile 根本连网络请求都不发
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
success: function (res) {
var path = res.tempFilePath;
console.log(path)
wx.uploadFile({
url: 'http://localhost/e_contract/public/index.php/member/index/test',
filePath: path,
name: 'file',
formData: {
'user': 'test'
},
header: { "Content-Type": "multipart/form-data", 'Cookie': 'PHPSESSID=' + overall.json.token},
success: function (res) {
var data = res.data
console.log(res);
//do something
},
fail:function(res){
}
})
}
})
没玩过小程序,但你用localhost?微信不知道你的localhost吧