使用服务器的ip地址发送数据时,后端可以接收到。
wx.uploadFile({
filePath: that.data.tempFilePaths[0],
url: 'http://81.70.147.103:8000/fileupload',
method:'POST',
name:"file",
header: {
'content-type': 'multipart/form-data',
},
但是使用域名时就会出现错误
wx.uploadFile({
filePath: that.data.tempFilePaths[0],
url: 'https://coderfly:8000/fileupload',
method:'POST',
name:"file",
header: {
'content-type': 'multipart/form-data',
},
错误提示如下
{errMsg: "uploadFile:fail Error: getaddrinfo ENOTFOUND coderfly"}