Start with Storage_
Get started quickly with Appwrite Storage. Follow step-by-step instructions to set up storage, upload files, and integrate cloud storage into your projects
1 min read
You can create your first bucket, upload, and download your first file in minutes.
Create bucket
You can create a bucket in the Appwrite Console by navigating to Storage > Create bucket.
In your bucket, navigate to Settings > Permissions, then add a new Any role with CREATE and READ permissions. This allows anyone to create and read files in this bucket.
Create file
To upload a file, add this to your app. For web apps, you can use the File object directly. For Node.js apps, use the InputFile class.
import { Client, Storage, ID } from "appwrite";
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>');
const storage = new Storage(client);
const promise = storage.createFile({ bucketId: '<BUCKET_ID>', fileId: ID.unique(), file: document.getElementById('uploader').files[0]});
promise.then(function (response) { console.log(response); // Success}, function (error) { console.log(error); // Failure});Download file
To download a file, use the getFileDownload method.
import { Client, Storage } from "appwrite";
const client = new Client();
const storage = new Storage(client);
client .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<PROJECT_ID>') // Your project ID;
const result = storage.getFileDownload({ bucketId: '<BUCKET_ID>', fileId: '<FILE_ID>'});
console.log(result); // Resource URLWas this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.