Standard Upload
For files under 6MB, use the standard upload method:Upload Options
Customize uploads with various options:Available Options
| Option | Type | Description |
|---|---|---|
cacheControl | string | HTTP Cache-Control header value |
contentType | string | MIME type of the file |
upsert | boolean | Overwrite file if it exists |
duplex | string | Set to ‘half’ for larger files |
File Upload Component
Complete React component for file uploads:React Component
Resumable Uploads
For files larger than 6MB, use TUS protocol for resumable uploads:Using Uppy.js
Resumable Upload with Signed URLs
Upload from URL
Download from a URL and upload to Storage:Upload Base64 Image
Convert and upload base64 encoded images:Drag and Drop Upload
React Drag & Drop
Upload Multiple Files
Update Existing File
Overwrite an existing file:File Validation
Always validate files before uploading:Error Handling
Common upload errors and solutions:| Error | Description | Solution |
|---|---|---|
Bucket not found | Bucket doesn’t exist | Create the bucket first |
new row violates row-level security policy | RLS blocking upload | Check RLS policies |
Payload too large | File exceeds size limit | Use resumable upload |
The object name is invalid | Invalid filename | Sanitize filename |
Best Practices
Generate Unique Names
Use timestamps or UUIDs to prevent filename collisions
Validate Client-Side
Check file size and type before uploading
Use Resumable Uploads
For files over 6MB, use TUS protocol
Set Proper MIME Types
Always specify the correct contentType
Next Steps
Download Files
Learn how to retrieve uploaded files
Image Transformations
Resize and optimize images on-the-fly
