时间:2019-05-07 来源:小程序工厂
感觉无法解答的请在这里赞1.
因为地址是用的我们本地的域名,所以直接粘到这里里
wx.uploadFile({
url: 'http://********',
// filePath: that.data.Images[0].url,
filePath: that.data.Images[0].url,
name: 'uploadfile_ant',
formData: {
"info": "aaaa",
"longti": "0.0",
"lati": "0.0",
"prio": "aa",
"username": "aaaa",
},
header: {
"Content-Type": "multipart/form-data",
"Cookie":"JSESSIONID=wKgByBroW8_nOOyBu8CynkHZs3MbTA2vYoEA"
},
})
这样是可以执行的,但是图片地址不能为空
但是
wx.request({
url: 'http://******',
data: {
"info": "aaaa",
"longti": "0.0",
"lati": "0.0",
"prio": "aa",
"username": "aaaa",
},
method: "POST",
header: {
"Content-Type": "multipart/form-data",
"Cookie": "JSESSIONID=wKgByBroW8_nOOyBu8CynkHZs3MbTA2vYoEA"
},
success: function (res){
console.log(res);
},
fail: function () {
},
complete: function () {
}
})
这样cookie是传不过去的。
麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题
因为地址是用的我们本地的域名,所以直接粘到这里里
wx.uploadFile({
url: 'http://********',
// filePath: that.data.Images[0].url,
filePath: that.data.Images[0].url,
name: 'uploadfile_ant',
formData: {
"info": "aaaa",
"longti": "0.0",
"lati": "0.0",
"prio": "aa",
"username": "aaaa",
},
header: {
"Content-Type": "multipart/form-data",
"Cookie":"JSESSIONID=wKgByBroW8_nOOyBu8CynkHZs3MbTA2vYoEA"
},
})
这样是可以执行的
但是
wx.request({
url: 'http://******',
data: {
"info": "aaaa",
"longti": "0.0",
"lati": "0.0",
"prio": "aa",
"username": "aaaa",
},
method: "POST",
header: {
"Content-Type": "multipart/form-data",
"Cookie": "JSESSIONID=wKgByBroW8_nOOyBu8CynkHZs3MbTA2vYoEA"
},
success: function (res){
console.log(res);
},
fail: function () {
},
complete: function () {
}
})
这样cookie是传不过去的。
麻烦按教程提供下,这样贴代码比较难查