React-Native-FS改变了Tourl本身

发布于 2025-02-10 07:17:06 字数 759 浏览 0 评论 0原文

我的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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心碎无痕… 2025-02-17 07:17:06

确保您已连接到互联网。我遇到了同样的问题,我意识到我没有连接,在我连接到互联网后解决了问题

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文