Back

Unable to post Images on Appwrite.

  • 1
  • Android
  • React Native
A R S H
31 Aug, 2024, 10:25

Hi I am unable to post Image on my appwrite storage. I am using React-Native please review my code

export const uploadImageToAppwrite = async (urin) => { try { const result = await storage.createFile( appwriteConfig.storageId, ID.unique(), { name: "photo.jpg", type: "image/jpg", uri: urin, }, [ Permission.read(Role.any()), Permission.update(Role.users()), Permission.delete(Role.users()), ] );

TypeScript
console.log("File uploaded successfully:", result);

} catch (error) { console.error("File upload failed:", error); } };

TL;DR
Developers are having trouble posting images on Appwrite using React-Native. They are unsure about the RN SDK version being used. The provided code snippet shows an attempt to upload an image to Appwrite storage. Potential solution: The code seems to be missing the necessary imports and initialization for Appwrite storage. Ensure that the SDK is properly set up and the required configurations are provided before attempting to upload the image.
D5
31 Aug, 2024, 10:56

What version of the RN SDK are you using?

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