client .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('647170480f75d7bd5b41') // Your project ID ;
methods: { handleFileUpload(event) { this.file = event.target.files[0]; }, async submitFile() { try { const response = await storage.createFile('64717d445b7a640fc647', ID.unique(), document.getElementById('file').files[0]); console.log(response); // Success } catch (error) { console.log(error); // Failure } }
}
import { Client, Storage, ID } from "appwrite";
Like this
Alright
Still having the same CORS error : Acess to XMLHttpRequest at 'https://cloud.appwrite.io/v1/storage/buckets/64717d445b7a640fc647/files' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
When i tried to upload
What else do you get in the console?
As localhost should be enabled
These are what I'm seeing on my console
AppwriteException: Network request failed at Client.eval (webpack-internal:///./node_modules/appwrite/dist/esm/sdk.js:423:23) at Generator.throw (<anonymous>) at rejected (webpack-internal:///./node_modules/appwrite/dist/esm/sdk.js:42:65) browser-ponyfill.js:518 POST https://cloud.appwrite.io/v1/storage/buckets/64717d445b7a640fc647/files net::ERR_FAILED 404 eval @
So it's still 404
Can you check two things
- That this bucket is indeed inside this project and it has the necessary permissions.
- Share a screenshot of the preview tab inside the
networktab
Yes.
Please can you explain what you meant in 2 ?
This is it, it's not showing any data
And the one after?
Same input
Everything looks allright. Can you share your bucket settings screen?
I ticked all
Is the URL is like this?
console/project-647170480f75d7bd5b41/storage/bucket-64717d445b7a640fc647/settings
With this IDs?
Yes it is
When I'm running this credentials it having problem finding the project ID
So the project ID is the issue ?
This the error i always get when i click to read the error:
{"message":"Storage bucket with the requested ID could not be found.","code":404,"type":"storage_bucket_not_found","version":"0.10.22"}
Hello @Binyamin i have solved it
[SOLVED] FIle Upload: CORS Error policy
Cool 👍👍
Recommended threads
- i need help!
I was working on my project and I just can't stop receiving this message. Is something wrong?
- Request for JWKS Endpoint and OIDC Disco...
Hey Appwrite Team, Do you have plans to support JWKS and a well-known OIDC discovery endpoint? This would let us verify Appwrite JWTs in other services using st...
- Sites are not opening
my all sites are not opening so plz check what is the issue, when i am opening the sites showing an error like, Access to XMLHttpRequest at 'https://cloud.appw...