Skip to main content
This guide covers everything you need to know about handling file uploads with Supabase Storage, from basic uploads to advanced features like resumable uploads and image transformations.

What You’ll Learn

  • Upload files to Supabase Storage
  • Download and display files
  • Implement resumable uploads for large files
  • Apply image transformations
  • Set up access control policies
  • Handle file metadata

Prerequisites

  • A Supabase project
  • Basic understanding of JavaScript/TypeScript
  • Supabase client library installed

Storage Basics

Supabase Storage organizes files in buckets. Each bucket can have:
  • Public or private access
  • Custom file size limits
  • Allowed MIME types
  • Storage policies for access control
1

Create a Storage Bucket

In your Supabase Dashboard:
  1. Navigate to Storage
  2. Click New bucket
  3. Configure your bucket:
    • Name: uploads (or your preferred name)
    • Public bucket: Toggle on for public access
    • File size limit: Set as needed (e.g., 50MB)
    • Allowed MIME types: Leave empty or specify types
  4. Click Create bucket
2

Set Up Storage Policies

Create policies to control access:
3

Basic File Upload

Create a simple file upload component:
4

Upload with Progress Tracking

Track upload progress for better UX:
5

Resumable Upload with Uppy

For large files, use resumable uploads with Uppy:Install dependencies:
Create the component:
6

Image Upload with Transformations

Upload and transform images:
7

Download Files

Download files from storage:
8

List Files in a Bucket

List and display uploaded files:

Advanced Features

Image Transformations

Supabase Storage supports on-the-fly image transformations:

File Metadata

Store custom metadata with files:

Signed URLs

Create temporary signed URLs for private files:

Best Practices

File Naming

Use unique filenames to avoid conflicts. Consider using UUIDs or timestamps.

File Size Limits

Set appropriate file size limits in your bucket settings and validate on the client.

MIME Type Validation

Restrict allowed file types to prevent malicious uploads.

Folder Organization

Organize files in folders using paths like userId/filename.ext.

Error Handling

Always handle errors gracefully and provide user feedback.

Next Steps

Storage Policies

Learn about advanced access control

Image Transformations

Master image manipulation

User Management

Build complete user profiles

Storage Examples

Explore more storage examples