
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
network
tab

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
- exclude password field from getDocument
i got a getDocument that lists data from the user (username, password, id.....) so my question is how do i exclude the password so it doesnt get listed out? m...
- Date objects behaving weird
I've programmed an app that uses Date objects. Everything works perfectly in my local environment, but on my hosted version with Vercel, the times of the object...
- Login with google error, Error 400: redi...
Hi, when i login with Oauth2 , using createOAuth2Session( 'google', 'http://localhost:5173/', 'http://localhost:5173/' ); It give...
