Storage
upload()
upload()
Overload 1 of 2
Use nhost.storage.upload
to upload a file.
It’s possible to use File
or FormData
to upload a file. The File
instance is only available in the browser while FormData
with form-data
works both in the browser and in NodeJS (server).
If no bucketId
is specified the bucket default
is used.
Parameters
params required StorageUploadFileParams
Property | Type | Required | Notes |
---|---|---|---|
params.file | File | ✔️ | |
params.bucketId | string | ||
params.name | string | ||
params.id | string | ||
params.headers | Record<string, string> |
Examples
Upload a file from a browser using File
.
Upload a file from a browser using File
to a specific Bucket.
Upload a file from a server using FormData
with form-data
.
Overload 2 of 2
Parameters
params required StorageUploadFormDataParams
Property | Type | Required | Notes |
---|---|---|---|
params.formData | FormData | FormData | ✔️ | |
params.bucketId | string | ||
params.headers | Record<string, string> |