How-to guides

Upload files to storage buckets with policies

Storage keeps files in buckets next to your database, with the same policy model as your tables.

Upload

upload.ts
const { data, error } = await supabase.storage
  .from('avatars')
  .upload(`${user.id}/avatar.png`, file, { upsert: true })

Public or signed URLs

urls.ts
// public bucket
supabase.storage.from('avatars').getPublicUrl(path)
// private bucket: a link valid for one hour
await supabase.storage.from('invoices').createSignedUrl(path, 3600)

Policies

Restrict who can upload or read with policies on storage.objects, for example letting users write only inside a folder named after their user id:

SQL editor
create policy "Users manage own folder" on storage.objects
  for all to authenticated
  using (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text)
  with check (bucket_id = 'avatars' and (storage.foldername(name))[1] = auth.uid()::text);

Questions

Can I browse files in the dashboard?

Yes, under Storage in your project.

Updated 2026-10-23.