--- id: storage-from-update title: "from.update()" slug: storage-from-update custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supabase.yml --- import Tabs from '@theme/Tabs'; import TabsPanel from '@theme/TabsPanel'; Replaces an existing file at the specified path with a new one. ```js const avatarFile = event.target.files[0] const { data, error } = await supabase .storage .from('avatars') .update('public/avatar1.png', avatarFile, { cacheControl: '3600', upsert: false }) ``` ## Parameters ## Notes - Policy permissions required: - `buckets` permissions: none - `objects` permissions: `update` and `select` - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below. ## Examples ### Update file ```js const avatarFile = event.target.files[0] const { data, error } = await supabase .storage .from('avatars') .update('public/avatar1.png', avatarFile, { cacheControl: '3600', upsert: false }) ``` ### Update file using `ArrayBuffer` from base64 file data ```js import {decode} from 'base64-arraybuffer' const { data, error } = await supabase .storage .from('avatars') .update('public/avatar1.png', decode('base64FileData'), { contentType: 'image/png' }) ```