如何上传文件到本地服务器

发布于 7 年前作者 zhaowei19485 次浏览最后编辑 7 年前来自 ask

我是一个新手 勿喷

wx.chooseImage({

success: function (res) {

var tempFilePaths = res.tempFilePaths

wx.uploadFile({

url: http://localhost:81/,

filePath: tempFilePaths[0],

name: ‘file’,

formData: {

‘user’: ‘test’

},

success: function (res) {

var data = res.data

console.log(“–bindViewTap–”)

//do something

}

})

}

})

http://localhost:81/ 是我在自己电脑上搭建的服务器地址 然后上传图片 控制台打印了bindViewTap 但是图片并没有上传到目录 请问是怎么回事

2 回复
guiying67
guiying671 楼6 年前

@ghost 这个对域名有什么要求吗?

yong19
yong192 楼5 年前

uploadFile 合法域名