Closed loky-lp closed 7 months ago
hey @LoKy-dev,
thanks for the detailed explanation. I can't really reproduce the issue. When I use your code I end up with the error: message: "\"contentType\" is not allowed"
This happens because you restrict the contentType
by passing allowedContentTypes
and don't pass a file extension or the contentType
param into the upload
function.
The way our API currently works is: either use the contentType
you passed or check the file extension. Because you pass nothing, the API doesn't know the contentType
and rejects the request.
We probably can improve further on how the API determines the contentType but for now you would need to either pass the contentType
option to upload
or add a file extension.
we just shipped a new API version. The contentType
should be inferred automatically now.
@LoKy-dev could you verify, so we can close this issue? thanks
TL;DR Got
Error: Vercel Blob: Access denied, please provide a valid token for this resource
but thepathname
was missing the file extensionI was trying to perform a client upload in a sveltekit app, i set up the api handler and everything according to the documentation, but this weren't working and i really I had a hard time wrapping my head around the error i was getting every time:
I tried setting
validUntil
to a higher value but got nothing. I debugged every steps but everything seemed to work fine and the generated token seemed valid. The fix for me was to add the file extension the to pathname used in theupload
methodSetup
File
+server.ts
onSubmit function in
+page.svelte
Maybe related issue #456