Replaces an existing file at the specified path with a new one.
buckets
table permissions: noneobjects
table permissions: update
and select
Blob
, File
or FormData
does not work as intended. Update file using ArrayBuffer
from base64 file data instead, see example below.The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
The body of the file to be stored in the bucket.
const avatarFile = event.target.files[0] const { data, error } = await supabase .storage .from('avatars') .update('public/avatar1.png', avatarFile, { cacheControl: '3600', upsert: true })
import {decode} from 'base64-arraybuffer' const { data, error } = await supabase .storage .from('avatars') .update('public/avatar1.png', decode('base64FileData'), { contentType: 'image/png' })