wx.chooseMedia
压缩图-成功:
item={"tempFilePath":"wxfile://tmp_ab66228265fed1d8a5154e6aa9b56d4e8dd4baf17536ff7a.jpg","size":44310,"fileType":"image"}
ajaxOpts={"url":"https://mz...com/prod-api/system/oss/upload","headers":{"Authorization":"Bearer eyJ0eX...-inHseE"},"method":"post",
"data":{
"values":{"id1":"1765556568257994754","id2":"1710210876496","zd1":"hdxxpj"},
"files":{"file":"wxfile://tmp_ab66228265fed1d8a5154e6aa9b56d4e8dd4baf17536ff7a.jpg"}
},"cache":false,"timeout":60,"dataType":"json","report":false}
ret={"code":200,"msg":"操作成功","data":{"url":"http://mz...com/2024/03/12/43ecbe7b4d6048efa80e5eaf71e2f271.jpg","fileName":"2024/03/12/43ecbe7b4d6048efa80e5eaf71e2f271.jpg"}},err=undefined
原图(2M)-失败:
item={"tempFilePath":"wxfile://tmp_d6e47b700321fee7b747bfc1cb91cfc16abdea659433d781.jpg","size":3009487,"fileType":"image"}
ajaxOpts={"url":"https://mz...com/prod-api/system/oss/upload","headers":{"Authorization":"Bearer eyJ0eX...-inHseE"},"method":"post",
"data":{
"values":{"id1":"1765556568257994754","id2":"1710210891258","zd1":"hdxxpj"},
"files":{"file":"wxfile://tmp_d6e47b700321fee7b747bfc1cb91cfc16abdea659433d781.jpg"}
},"cache":false,"timeout":60,"dataType":"json","report":false}
ret=undefined,err={"errno":600001,"errMsg":"uploadFile:fail upload fail:-101:net::ERR_CONNECTION_RESET"}
看不懂,wx.request自动触发wx.uploadFile?
wx.uploadFile({
url: 'https://mz.../upload',
header:{
"Authorization": xxx
},
filePath: item.tempFilePath,
name: 'file',
formData: {
"id1":this.data.form.lsh,
"id2":timestamp,
"zd1":"hdxxpj"
},
success:res=>{
console.log("res="+JSON.stringify(res));
},
fail:err=>{
console.log("err="+JSON.stringify(err));
}
})
item={"tempFilePath":"wxfile://tmp_861e7fe239745c04afeb6f20ed4254f965e9ec713627a407.jpg","size":3009487,"fileType":"image"}
err={"errno":600001,"errMsg":"uploadFile:fail upload fail:-101:net::ERR_CONNECTION_RESET"}
是不是限制文件大小了,图片改成base64会不会限制