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
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...
- Courtesy limit reset for non-profit migr...
Hi Team! I'm the architect for a 501(c)(3) non-profit project (Aaria's Blue Elephant) and we just hit our Free plan Database Read limit (currently at 164%). Th...