ERROR Create file error, uploadImage: [TypeError: Cannot read property 'size' of undefined]
- 0
- React Native
- Storage

Hi, I am using React-native and appwrite for my project. I am trying to upload an image to Appwrite storage bucket but receiving error while creating and uploading the file. ERROR Create file error, uploadImage: [TypeError: Cannot read property 'size' of undefined]. Please help me with correct approach to store the image to bucket. The code I am using is provided below and frontend and console response is attached in the file.
Backend.js const uploadImage = async (imagefile) => { if (!imagefile) { console.error('No file provided for upload.'); return; }
console.log('File to Upload:', imagefile);
const asset = { name: imagefile.fileName, type: imagefile.type, size: imagefile.fileSize, uri: imagefile.uri, }; console.log('Prepared File for Upload:', asset); try { const uploadedFile = await storage.createFile( BUCKET_ID_IMAGE, ID.unique(), asset, ); console.log('Uploaded file:', uploadedFile);
return uploadedFile;
} catch (error) { console.error('Create file error, uploadImage:', error); throw error; } };
Recommended threads
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
- Create platform and can not connect ping
I created a new platform but when I cloned the source, I didn't see the lib/... folder, only env. Then I created a .env file and added those files, then pinged ...
- Row with the requested ID already exists...
I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
