A R S HOriginal post
Web Developer
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()),
]
);
console.log("File uploaded successfully:", result);
} catch (error) {
console.error("File upload failed:", error);
}
};
Summary
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.