upload

Uploads files based on the provided options.

Example

Uploading JSON objects

import { upload } from "thirdweb/storage";
const uri = await upload({
client,
files: [
{
name: "something",
data: {
hello: "world",
},
},
],
});
### Uploading files
```ts
import { upload } from "thirdweb/storage";
const uri = await upload({
client,
files: [
new File(["hello world"], "hello.txt"),
],
});

@storage

function upload(
options: UploadOptions<TFiles>,
): Promise<UploadReturnType<TFiles>>;

Parameters

The upload options.

Type

let options: UploadOptions<TFiles>;

Returns

let returnType: Promise<UploadReturnType<TFiles>>;

A promise that resolves to the uploaded file URI or URIs (when passing multiple files).