for循环上传多张图片,filepath出错,求大神
上传图片的时候,filepath出现错误
var imgfiles = that.data.files;
var fileslength = that.data.files.length;
for (var i = 0; i < fileslength; i++) {
setTimeout(function () {
wx.uploadFile({
url: that.data.net + “user/AddImage/v1?u_openid=” + that.data.openid,
filePath:imgfiles[i],
name: ‘fileName’,
success: function (res) {
console.log(res);
var data = res.data
//do something
}
})
}, 100)
}
2 回复