NerdkidChiki
NerdkidChiki•16mo ago

i am having issues with cors headers when trying to upload images from my front-end

Hi there, i am tryna setup image upload from my front end to my convex backend ,but whenever i try to upload the images i get this error, "No 'Access-Control-Allow-Origin' header is present on the requested resource." i have followed what docs adviced by setting cors for preflight, but it doesnt seem to work. i am using localhost:3000 how do i get pass this issue?
5 Replies
erquhart
erquhart•16mo ago
Can you share the action code?
Michal Srb
Michal Srb•16mo ago
GitHub
convex-demos/file-storage-with-http/convex/http.ts at main · get-co...
Demo apps built on Convex. Contribute to get-convex/convex-demos development by creating an account on GitHub.
NerdkidChiki
NerdkidChikiOP•16mo ago
Thanks so much....i later used the url method and it worked like a charm. I don't think am ever gonna try that http action method again. I mostly focus on frontend so i really don't understand any of that Cors stuff, although i did read up on it on Mdn, it still was confusing 😞 Hey there ....i wanna know if its possible to arrange my files in storage by folders or how do i manage my files in storage? Assuming i wanna store pdf files ina separate folder and images in a separate folder and images in a separate folder etc
Michal Srb
Michal Srb•16mo ago
Hey @NerdkidChiki, you can create a table (or tables) for managing stored files. For example a table with a "folder" field that references the Storage ID (also can store the file name).
NerdkidChiki
NerdkidChikiOP•16mo ago
I will try rhat.thankd so much

Did you find this page helpful?