upload()
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.
StorageUploadFileParams
Property | Type | Required | Notes |
---|---|---|---|
params.file | File | ✔️ | |
params.bucketId | string | ||
params.name | string | ||
params.id | string | ||
params.headers | Record<string, string> |
File
.
File
to a specific Bucket.
FormData
with form-data
.
StorageUploadFormDataParams
Property | Type | Required | Notes |
---|---|---|---|
params.formData | FormData | FormData | ✔️ | |
params.bucketId | string | ||
params.headers | Record<string, string> |