(PHP+CI framework) Below, the information of the file can be easily obtained, but the information in the formData cannot be obtained.
For example, in the following sample program, there is formData:{'user': 'test'}. On the server side, you can use $_FILES[file] to get the data of the uploaded file itself. So how to get the data transmitted in formData?
wx.chooseImage({
success: function(res) { var tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'http://example.weixin.qq.com/upload', //just an example, not real Interface address
filePath: tempFilePaths[0],
name: 'file',
})
}
})
Checked, formdata is stored in $_POST, such as the above case, on the server side:
_POST['user'];
For example, in the following sample program, there is formData:{'user': 'test'}. On the server side, you can use $_FILES[file] to get the data of the uploaded file itself. So how to get the data transmitted in formData?
wx.chooseImage({
success: function(res) { var tempFilePaths = res.tempFilePaths
wx.uploadFile({
url: 'http://example.weixin.qq.com/upload', //just an example, not real Interface address
filePath: tempFilePaths[0],
name: 'file',
formData:{
'user': 'test'
},success: function(res){
var data = res.data //do something
}})
}
})
Checked, formdata is stored in $_POST, such as the above case, on the server side:
_POST['user'];
You can get the value of $string to be 'test'.