
I am using this sample code in nextjs
const storeFile = async () => { try { const uploader = document.getElementById( "uploader" ) as HTMLInputElement | null; if (!uploader) { throw new Error("Uploader element not found"); }
const file = uploader.files?.[0];
console.log(file);
if (!file) {
throw new Error("No file selected");
}
const promise = await storage.createFile(
process.env.BUCKET_ID as string,
ID.unique(),
file
);
return promise;
} catch (err) { alert(err); } };

You can try this : https://github.com/appwrite/appwrite/issues/2687

What are the permissions on the bucket?

Role ANY Permissions CREATE READ UPDATE

Would you please switch to the network tab, find the request, and share the request headers?

yes its working now some issue with env variables. My env variables were coming undefined

thats why cors was coming

[SOLVED] Getting CORS error while uploading files to bucket

Hello @Steven I'm having the same issues. Can you please share how I can fix this? I'm new to Appwrite and still don't understand how some of the services work.
I keep having the COR Policy issue each time I try to submit the file. Could it be the problem is from my env variables ?

Please create a new <#1072905050399191082> post
Recommended threads
- Webhooks not working?
I have this webhook in appwrite but unfortunately this webhook isn't being triggered whenever I change something in the database. I've put the right databaseID ...
- Request: When Will Appwrite Sites Waitli...
Hey team! ๐ I recently joined the waitlist for Appwrite Sites on Cloud and got the confirmation email that says: "You've successfully joined the Sites waitli...
- 25 document limit
Unable to bypass the 25 document limit: https://github.com/Mooshieblob1/GenerateImagesPreview
