Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/routes/docs/products/storage/quick-start/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To upload a file, add this to your app. For web apps, you can use the File objec

{% multicode %}
```client-web
import { Client, Storage } from "appwrite";
import { Client, Storage, ID } from "appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
Expand Down Expand Up @@ -52,19 +52,10 @@ To upload a file, add this to your app. For web apps, you can use the File objec

const storage = new sdk.Storage(client);

// If running in a browser environment, you can use File directly
const browserFile = new File(['hello'], 'hello.txt');
await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: ID.unique(),
file: browserFile
});

// If running in Node.js, use InputFile
const nodeFile = InputFile.fromPath('/path/to/file.jpg', 'file.jpg');
await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: ID.unique(),
fileId: sdk.ID.unique(),
file: nodeFile
});
```
Expand Down