微信公开课
如何看待微信公开课小程序热门讨论「小程序上传图片的bug」
摘要:小程序上传图片的bug
展开:代码如下:请求都不走进success里面,每次都直接进入fail,和complete里面,也不发出请求,请问这是小程序的bug嘛chooseimage:function(){varthatthis;wx.chooseImage({count:4,//默认9sizeType:[original],//可以指定是原图还是压缩图,默认二者都有sourceType:[album,camera],//可以指定来源是相册还是相机,默认二者都有success:function(res){//返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片console.log(res,res)vartempFilePathsres.tempFilePaths;console.log(tempFilePaths,tempFilePaths)wx.uploadFile({url:https://apidev.lewaimai.com/customer/common/helper/uploadimage,filePath:tempFilePaths[0],name:file,formData:{},success:function(res){console.log(success,res)vardatares.data},fail:function(res){console.log(fail,res)},complete:function(res){console.log(complete,res)}})}})},resObject{errMsg:chooseImage:ok,tempFilePaths:Array[1],tempFileSizes:Array[1]}indextest.js[sm]:27tempFilePaths[wxfile://tmp_2045657002o6zAJs9aI4hmjPwS2a4SLTxOzHE62bf89aa726da5e9532c90439337a08b.jpg]indextest.js[sm]:40failObject{errMsg:uploadFile:failexceedmaxuploadconnectioncount10}indextest.js[sm]:43completeObject{errMsg:uploadFile:failexceedmaxuploadconnectioncount10}errMsg:uploadFile:failexceedmaxuploadconnectioncount10__proto__:Object了解更多