这是点击上传图片demo
uni.chooseImage({
success: function(res) {
var tempFilePaths = res.tempFilePaths
uni.uploadFile({
url: 'http://m.it-1024.net', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
formData:{
'user': 'test',
'url': 'http://m.it-1024.net'
},
success: function(res){
console.log(res)
}
})
}
})
php获取formData的数据
$_POST[“user”]获取到的就是test,
$_POST[“url”]获取到的就是链接http://m.it-1024.net