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
- Realtime Disconnects and Error: INVALID_...
Hi! I just want to ask here if there's any workaround with the disconnect issues we're encountering when subscribing to realtime events in react native using ex...
- Storage & Database is not allowing.
Storage & Database is not allowing to CRUD after i have logged in ? Using web SDK with next.js without any SSR or node-sdk.
- Privacy settings for storage
In my app the user could upload sensitive images for themselves (as a weight loss journal) and they probably don’t want developers or anyone else but themselves...
