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
- Domain is owned by a different organizat...
Hi Appwrite team, I'm trying to add my custom domain **futlive9.com** to my project, but I'm getting the error: "Domain is owned by a different organization." ...
- Get Profile picture
If I made an app where user need to sign in with Google. Now how do I access the user profile picture?
- Intermittent 60s edge-to-origin stalls r...
Anyone having this problem? Region: SFO. Plan: Pro. UPDATE: "Fastly's documentation notes that enabling origin shielding can resolve backend connection problem...