react-nativereact-native-fs

react-native-fs changes the toUrl itself


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.


Solution

  • 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