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
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...