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
- Bug: Access-Control-Allow-Origin = local...
I'm running into a persistent CORS issue on Appwrite Cloud (fra). When uploading a file via the REST API from my production frontend, the file uploads correctly...
- null
- Expo react native error
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'PlatformConstants' could not be found. Verify that a module by this name is registered in the nativ...
