I'm stuck on a CORS error when trying to upload fi...
# prisma-whats-new
w
I'm stuck on a CORS error when trying to upload files using https://fineuploader.com/
Copy code
POST https://api.graph.cool/file/v1/___ 500 (Internal Server Error)
add-app:1 XMLHttpRequest cannot load https://api.graph.cool/file/v1/___. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 500.
Any ideas how to fix this? â˜šī¸
n
@wojtek can you show me the code? 🙂
if you tell me your project id I might be able to find out more, too
n
ah, so you need to supply the form data with key
data
does fine uploader support an API to control the key?
n
also, nice name grab for
sh
😄
w
seems like it does
hah, i was surprised it actually wasn't taken!
n
I can't seem to find the option to modify the key in the fine uploader docs
w
i had it working without any issues using fetch
n
can you show me the upload request in your network tab?
we can compare it to fetch to see what's missing
w
maybe i'll just build my own gallery component then
sure, one sec
n
ah yea
see the request payload for the second request?
it should say
name="data"
but it says
name="qquuid"
w
whole payload
i see how it is now
n
yea
we need
data
there
let me try doing this
never mind, that didn't change the payload structure
w
yeah, i've used that example before
i was hoping, i'd be able to change file names before uploading since the HTML5
download
attribute does not work for different domains
n
you are able to do that
Copy code
Content-Disposition: form-data; name="data"; filename="test-file"
w
so just a matter of changing the header in the
fetch
request?
n
w
alright, thanks for the help Nilan. you're awesome! 😄
n
hmm let me know if you figure out the concrete syntax 😄
no problem!
could be a PR to the file upload example 🙂