Create File
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/storage/buckets/{bucketId}/files
Description
Create a new file. Before using this route, you should create a new bucket resource using either a server integration API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the content-range header to send a partial request with a maximum supported chunk of 5MB. The content-range header values should always be in bytes.
When the first request is sent, the server will return the File object, and the subsequent part request must include the file's id in x-appwrite-id header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
Required scopes
Authentication
setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.Rate limit
Path
Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
Body
File ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
Binary file.
An array of permission strings. By default the current user is granted with all permissions. Learn more about permissions.
File
File ID.
Bucket ID.
File creation date in ISO 8601 format.
File update date in ISO 8601 format.
File permissions. Learn more about permissions.
File name.
File MD5 signature.
File mime type.
File original size in bytes.
Total number of chunks available
Total number of chunks uploaded
import { Client, Storage } from "appwrite";
const client = new Client();
const storage = new Storage(client);
client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID;
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]);
promise.then(function (response) { console.log(response); // Success}, function (error) { console.log(error); // Failure});Storage
Create File
Endpoint
posthttps://<REGION>.cloud.appwrite.io/v1/storage/buckets/{bucketId}/files
Description
Create a new file. Before using this route, you should create a new bucket resource using either a server integration API or directly from your Appwrite console.
Larger files should be uploaded using multiple requests with the content-range header to send a partial request with a maximum supported chunk of 5MB. The content-range header values should always be in bytes.
When the first request is sent, the server will return the File object, and the subsequent part request must include the file's id in x-appwrite-id header to allow the server to know that the partial upload is for the existing file and not for a new one.
If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
Required scopes
Authentication
setProject() and ensure the user is signed in. The SDK sends the session header automatically after login.Rate limit
Path
Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.
Body
File ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
Binary file.
An array of permission strings. By default the current user is granted with all permissions. Learn more about permissions.
File
File ID.
Bucket ID.
File creation date in ISO 8601 format.
File update date in ISO 8601 format.
File permissions. Learn more about permissions.
File name.
File MD5 signature.
File mime type.
File original size in bytes.
Total number of chunks available
Total number of chunks uploaded
import { Client, Storage } from "appwrite";
const client = new Client();
const storage = new Storage(client);
client .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint .setProject('5df5acd0d48c2') // Your project ID;
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]);
promise.then(function (response) { console.log(response); // Success}, function (error) { console.log(error); // Failure});