小程序之上傳圖片——wx.uploadFile()

js代碼

uploadFile: function () {
wx.chooseImage({
success: function (res) {

console.log(res);
var path=res.tempFilePaths[0];
wx.uploadFile({
url: 'https://www.minshu.xin/My/index.php/Home/Index/uploadfile',
filePath: path,
name: 'file',
formData:{
data1:"w",
},
success:function(res){
console.log(res);
},
fail :function(res){
console.log("tt");
}
})
},
})

},

後端代碼:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章