upload()
Ce contenu n’est pas encore disponible dans votre langue.
Signature
massi.storage.from(bucket: string).upload( key: string, file: Blob, opts?: { contentType?: string }): Promise<{ data: StorageObject | null; error: MassiCloudError | null }>Example
const file = fileInput.files[0] // a Blob/File from an <input type="file">
const { data, error } = await massi.storage .from('avatars') .upload('users/42/photo.txt', file)Notes
- Requires a signed-in end user —
massi.auth.signIn()first. Anonymous uploads are rejected even on public buckets. keysets the full object path, including any folder-like prefix (users/42/photo.txt).opts.contentTypeoverrides the file’s own MIME type if you need to set it explicitly.