Back

[SOLVED] Uploading File from React Native Client

  • 0
  • Web
  • Storage
  • Cloud
Jonathan G.
1 Oct, 2023, 20:11

Hi, I'm writing an app with Expo, React Native and Appwrite Cloud. My goal is to upload an image to the bucket storage. I have tested the bucket with REST requests and that worked fine. However, I cannot get it to work with the Web SDK. I am using the newest version 13.0.0 but tested it also with older ones.

When I try calling const response = await api.uploadProfileImage(file) it catches this error: {"name":"AppwriteException","code":0,"type":"","response":""}

I tried it using different Files with the new File constructor from JS and also double checked all other params. I cannot make sense of the issue. Auth and DB both work fine in the project.

TL;DR
The user was having trouble uploading an image from a React Native client using the Appwrite Cloud Web SDK. After some troubleshooting, the user found a workaround by following a GitHub comment. The issue was resolved.
Drake
1 Oct, 2023, 23:49

There's a problem with how react native handles multipart form data.

Use this workaround: https://github.com/appwrite/sdk-for-web/issues/27#issuecomment-1710914979

Jonathan G.
2 Oct, 2023, 19:48

It worked with that, thanks <:appwriteheart:782571497393750036>

Jonathan G.
2 Oct, 2023, 19:48

[SOLVED] Uploading File from React Native Client

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more