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
const { data, error } = await supabase.storage
.from('avatars')
.upload(`${user.id}/avatar.png`, file, { upsert: true })Public or signed URLs
// 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:
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.
Related
- Row Level Security (RLS) explained with examples
- Add Google and GitHub sign-in with supabase-js
- Passwordless magic link login
- Semantic search with pgvector
- Quickstart
- supabase-js client docs
Updated 2026-10-23.