var time = new Date()
var date = time.getTime()//获取日期 分日期 文件夹存储
console.log(“开始上传” + j + “图片到服务器:”)
//上传返回值
var upload_task = wx.uploadFile({
url: ‘https//www.fooskin.com.cn/wx_upload.php’,//需要用HTTPS,同时在微信公众平台后台添加服务器地址
filePath: upload_picture_list[j][‘path’], //上传的文件本地地址
name: ‘file’,
formData: {
‘num’: j,
‘datetime’: time,
‘date’: date
},
//附近数据,这里为路径
success: function (res) {
console.log(res.data)
var data = JSON.parse(res.data)
//字符串转化为JSON
if (data.Success == true) {
console.log(‘OK’)
//var filename = “https://127.0.0.1:8095/” + data.file//存储地址 显示
var filename = data.file//存储地址 显示
upload_picture_list[j][‘path_server’] = filename
} else {
var filename = “https://www.fooskin.com.cn/xx.png”//错误图片 显示
upload_picture_list[j][‘path_server’] = filename
}
that.setData({
upload_picture_list: upload_picture_list
})
},
fail: (res) => {
console.log(res.errMsg);
}
})
最后提示uploadFile:fail createUploadTask:fail url not in domain list,是什么原因