#React native expo file upload issue

17 messages · Page 1 of 1 (latest)

ember eagle
#

I developed a React Native app with Expo. I'm using USB to connect my phone and everything is going great - fetching/updating/etc. However, I can't upload files. I get this error: Error in uploadFile: [AppwriteException: Network request failed]. The network is OK... Please help.
when im using a react PWA with the same appwrite project it is working.

ember eagle
#

anyone?

warped prism
#

React native expo file upload issue

warped prism
#

What are the network logs?

#

Is the device able to login or make any other things/connect to appwrite?

golden fulcrum
#

I'm running into the same issue only there is no error thrown, but no file shows up either.

const uploadImage = async (uri) => {
    try {
      console.log("Uploading file from URI:", uri);

      const fileId = ID.unique();
      console.log("Uploading file with ID:", fileId);
      const uploadedFile = await storage.createFile(
        APPWRITE_BUCKET_ID,
        fileId,
        uri
      );
      console.log("Uploaded file:", uri);
      return fileId;
    } catch (error) {
      console.error("Error in uploadImage:", error);
      throw new Error("Failed to upload image: " + error.message);
    }
   
  };
#

so that catch never fires, it just returns the fileId

#

for @ember eagle make sure SSL is setup if you're self hosted. Make sure permissions are correct in your console on that bucket

golden fulcrum
#

That got me past the network error, yes

#

Now, I am not getting file in the console with the above code

warped prism
golden fulcrum
#

ok

ember eagle
ember eagle