1. 程式人生 > >小程式之上傳圖片——wx.uploadFile()

小程式之上傳圖片——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"); } }) }, })
},

後端程式碼: