- 当前 Bug 的表现(可附上截图)
上传文件后用后台打印$_FILES变量,其文件格式为undefined-undefined-undefined
"undefined-undefined-undefined":{"name":"wx8d8f044b2694672e.o6zAJs-vXPcEgHfG5iIzju50LAZE.u2EBcYXgkRO9b0446cf91da6e1710b881b86e939bf19.jpg","type":"image\/jpeg","tmp_name":"C:\\Windows\\Temp\\php66C2.tmp","error":0,"size":137134
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
---------------------------------------------------------------------------------------------------
name设置的是无效值,所以是undefined
小程序图片上传怎么写的?
wx.uploadFile({
url:
'http://www.zhygl.com/save_express_image.php'
,
filePath:
this
.data.files[0],
name: image_name,
header: {
'content-type'
:
'multipart/form-data'
},
formData: {
target_date:
this
.data.target_date,
target_time:
this
.data.target_time
},
success:
function
(res) {
console.log(res)
}
})
我知道了,我的name设置的是无效值...谢谢!