Python: Replace an existing file (original) (raw)

Replaces an existing file at the specified path with a new one.

Parameters

(Required)
The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.

(Required)
The body of the file to be stored in the bucket.

(Required)
undefined

Examples

Update file

with open("./public/avatar1.png", "rb") as f:
    response = (
        supabase.storage
        .from_("avatars")
        .update(
            file=f,
            path="public/avatar1.png",
            file_options={"cache-control": "3600", "upsert": "true"}
        )
    )