React-Native-FS改变了Tourl本身
我的URL是=> http://180.100.200.200.202/api/files/upload
这是我的代码
uploadFiles({
toUrl: "http://180.100.200.202/api/files/upload",
files: files,
method: "POST",
headers: { Accept: "application/json" },
begin: () => {
},
progress: ({ totalBytesSent, totalBytesExpectedToSend }) => {
// console.log({ totalBytesSent, totalBytesExpectedToSend })
},
})
.promise.then(_ => {
})
.catch(_ => {
console.log(_)
})
时,当我调用上述代码时,我会收到以下错误:
[Error: Failed to connect to /180.100.200.202:80]
这不是我的URL。为什么会改变?
编辑:它在模拟器中完美工作,但在手机中却没有。
my url is => http://180.100.200.202/api/files/upload
this is my code
uploadFiles({
toUrl: "http://180.100.200.202/api/files/upload",
files: files,
method: "POST",
headers: { Accept: "application/json" },
begin: () => {
},
progress: ({ totalBytesSent, totalBytesExpectedToSend }) => {
// console.log({ totalBytesSent, totalBytesExpectedToSend })
},
})
.promise.then(_ => {
})
.catch(_ => {
console.log(_)
})
when I call the above code I get the following error:
[Error: Failed to connect to /180.100.200.202:80]
this is not my url. why it changes ?
EDIT: It works perfectly in emulator but in cell phone does not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您已连接到互联网。我遇到了同样的问题,我意识到我没有连接,在我连接到互联网后解决了问题
make sure you are connected to the internet. I had the same problem, and I realized that I am not connected, after I connect to the internet the problem solved