from.update()
Replaces an existing file at the specified path with a new one.
- JavaScript
const avatarFile = event.target.files[0]
const { data, error } = await supabase
.storage
.from('avatars')
.update('public/avatar1.png', avatarFile)
Parameters
pathrequired
string
The relative file path including the bucket ID. Should be of the format
bucket/folder/subfolder
. The bucket already exist before attempting to upload.filerequired
File
The file object to be stored in the bucket.
fileOptionsoptional
FileOptions
HTTP headers. For example
cacheControl
Notes
- Policy permissions required:
buckets
permissions: noneobjects
permissions:update
andselect
Examples
Update file
- JavaScript
const avatarFile = event.target.files[0]
const { data, error } = await supabase
.storage
.from('avatars')
.update('public/avatar1.png', avatarFile)