Set up Firebase Cloud Storage in FlutterFlow by configuring Storage security rules scoped to authenticated users, using FlutterFlowUploadButton for file and image uploads, and storing download URLs in Firestore documents. Organize files into user-specific folders, build a file browser with ListView, and add delete functionality through Custom Actions that remove both the Storage file and its Firestore reference.
Integrating Firebase Cloud Storage with FlutterFlow
Most apps need file storage for user avatars, documents, images, and media. This tutorial covers setting up Firebase Storage in FlutterFlow with proper security rules, uploading files with the built-in upload widget, organizing files into folder structures, and building a file browser for listing and managing uploaded content.
Prerequisites
- A FlutterFlow project with Firebase connected and authentication enabled
- Firebase Storage enabled in the Firebase Console
- Basic familiarity with Firestore for storing file metadata
Step-by-step guide
Configure Firebase Storage security rules
Configure Firebase Storage security rules
In the Firebase Console, go to Storage and open the Rules tab. Replace the default rules with authentication-scoped rules. Allow users to read and write only within their own folder path: match /users/{uid}/{allPaths=**} with the condition request.auth.uid == uid. Add a separate rule for a public folder that allows read access to all authenticated users but write access only to admins. Set maximum file size limits in the rules using request.resource.size < 10 * 1024 * 1024 for a 10MB cap. Publish the rules.
1rules_version = '2';2service firebase.storage {3 match /b/{bucket}/o {4 // User-specific files5 match /users/{uid}/{allPaths=**} {6 allow read, write: if request.auth != null 7 && request.auth.uid == uid8 && request.resource.size < 10 * 1024 * 1024;9 }10 // Public files (read: any auth user, write: admin only)11 match /public/{allPaths=**} {12 allow read: if request.auth != null;13 allow write: if request.auth.token.admin == true;14 }15 }16}Expected result: Storage rules enforce that users can only access files in their own folder and files are limited to 10MB.
Set up the upload flow with FlutterFlowUploadButton
Set up the upload flow with FlutterFlowUploadButton
On your page, add a FlutterFlowUploadButton widget. In the Properties Panel, set the upload type to Firebase Storage. Set the storage folder path to users/{currentUser.uid}/documents/ so each user's files go into their own folder. Configure allowed file types: for images use image/jpeg, image/png; for documents add application/pdf. Set a maximum file size. The widget automatically uploads the file and returns the download URL as an Action Output Variable. After upload completes, create a Firestore document in a user_files collection with fields: fileName (String), fileUrl (String, the download URL), fileType (String), fileSize (Integer), uploadedAt (Timestamp), and userId (String).
Expected result: Users can upload files that are stored in Firebase Storage with metadata saved in Firestore.
Build a file browser with ListView
Build a file browser with ListView
Create a FilesPage with a ListView bound to a Backend Query on the user_files collection, filtered by userId equals currentUser.uid, ordered by uploadedAt descending. Each row displays a Container with a Row inside: an Icon widget showing the file type icon (image icon for images, description icon for PDFs, insert_drive_file for others — use conditional logic on fileType), the fileName as Text, the file size formatted as Text, and an IconButton for delete. Add a tap action on the Container that opens the file: for images, navigate to a fullscreen Image viewer; for PDFs, open in a WebView or use url_launcher to open the download URL in the browser.
Expected result: A file manager listing all uploaded files with type icons, names, sizes, and tap-to-open functionality.
Implement file deletion with Custom Action
Implement file deletion with Custom Action
Create a Custom Action named deleteFile that takes the Storage file path and the Firestore document reference as parameters. The action first deletes the file from Firebase Storage using FirebaseStorage.instance.ref(path).delete(), then deletes the corresponding Firestore document. Wire this to the delete IconButton on each file row with a confirmation dialog first. Use Show Dialog with a question asking 'Are you sure you want to delete this file?' with Confirm and Cancel buttons. Only call the deleteFile action when the user confirms.
1// Custom Action: deleteFile2import 'package:firebase_storage/firebase_storage.dart';3import 'package:cloud_firestore/cloud_firestore.dart';45Future<void> deleteFile(6 String storagePath,7 DocumentReference fileDocRef,8) async {9 // Delete from Storage10 await FirebaseStorage.instance.ref(storagePath).delete();11 // Delete Firestore metadata12 await fileDocRef.delete();13}Expected result: Deleting a file removes it from both Firebase Storage and the Firestore metadata collection.
Add image preview and upload progress feedback
Add image preview and upload progress feedback
For image files, add a GridView alternative to the ListView that shows thumbnail previews. Use the Image widget with the fileUrl and BoxFit.cover inside square Containers. Add a toggle between list view and grid view using a Page State boolean and Conditional Builder. For upload progress, wrap the FlutterFlowUploadButton action flow with a Page State isUploading boolean: set true before upload, false after. Show a LinearProgressIndicator when isUploading is true. Add a SnackBar notification on successful upload showing the file name and a checkmark.
Expected result: Image files display as a thumbnail grid, uploads show progress feedback, and successful uploads trigger a confirmation notification.
Complete working example
1FIREBASE STORAGE RULES:2 /users/{uid}/** → read/write if auth.uid == uid, max 10MB3 /public/** → read if authenticated, write if admin45FIRESTORE DATA MODEL:6 user_files/{fileId}7 fileName: String8 fileUrl: String (Storage download URL)9 storagePath: String (for deletion)10 fileType: String (image/jpeg, application/pdf, etc.)11 fileSize: Integer (bytes)12 uploadedAt: Timestamp13 userId: String1415PAGE: FilesPage16WIDGET TREE:17 Column18 ├── Row (header)19 │ ├── Text ("My Files")20 │ ├── IconButton (grid/list toggle)21 │ └── FlutterFlowUploadButton22 │ Upload to: Firebase Storage23 │ Path: users/{uid}/documents/24 │ Allowed: image/*, application/pdf25 │ On Complete:26 │ 1. Create Document: user_files/27 │ 2. Show SnackBar ("File uploaded")28 ├── LinearProgressIndicator (Conditional: isUploading)29 └── Conditional Builder (listView vs gridView)30 ├── ListView (list mode)31 │ Backend Query: user_files, userId == currentUser32 │ └── Container33 │ └── Row34 │ ├── Icon (file type icon)35 │ ├── Column (fileName + size)36 │ └── IconButton (delete)37 │ On Tap: Confirm Dialog → deleteFile()38 └── GridView (grid mode, crossAxisCount: 3)39 └── Container (square)40 └── Image (fileUrl, BoxFit.cover)4142CUSTOM ACTION: deleteFile(storagePath, fileDocRef)43 1. FirebaseStorage.instance.ref(storagePath).delete()44 2. fileDocRef.delete()Common mistakes
Why it's a problem: Setting Storage rules to allow read, write: if true
How to avoid: Always require authentication and scope paths so users can only access their own folder: allow read, write: if request.auth.uid == uid.
Why it's a problem: Storing only the download URL without the storage path
How to avoid: Save both the download URL (for display) and the storage path (for deletion) in the Firestore metadata document.
Why it's a problem: Not setting file size limits in Storage rules
How to avoid: Add request.resource.size < maxBytes to your Storage rules. Typical limits: 10MB for documents, 5MB for images.
Best practices
- Always store file metadata in Firestore alongside Storage URLs for querying and display
- Scope Storage rules to authenticated users and their own folder paths
- Set maximum file size limits in both Storage rules and the upload widget configuration
- Organize files into logical folder structures: users/{uid}/profile/, users/{uid}/documents/
- Show upload progress and completion feedback to the user
- Store the storage path alongside the download URL so files can be deleted later
- Add file type icons to help users visually identify different document types
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to set up Firebase Cloud Storage in FlutterFlow. Show me the Storage security rules scoped per user, how to use FlutterFlowUploadButton, how to store metadata in Firestore, and how to build a file browser with delete functionality.
Create a file manager page with an upload button at the top, a toggle between list and grid view, and a list of uploaded files showing the file name, type icon, and a delete button.
Frequently asked questions
What file types can I upload with FlutterFlowUploadButton?
You can upload any file type including images, PDFs, videos, audio, and documents. Configure allowed MIME types in the widget properties to restrict uploads to specific formats like image/jpeg, image/png, or application/pdf.
Is there a file size limit for Firebase Storage?
Firebase Storage supports files up to 5TB per object. However, you should enforce practical limits in your Storage rules (for example 10MB) to prevent abuse and ensure your app handles files efficiently.
Can I make some files publicly accessible?
Yes. Upload files to a public folder path and set Storage rules to allow read access for all authenticated users on that path. The download URL can then be shared and accessed by any logged-in user.
How do I display uploaded PDFs in the app?
Use a WebView widget pointed at the file download URL, or use the url_launcher package to open the PDF in the device's default PDF viewer. For an in-app experience, consider a Custom Widget with the flutter_pdfview package.
Can I upload multiple files at once?
FlutterFlowUploadButton handles one file at a time. For multi-file upload, add multiple upload buttons or create a Custom Action that loops through a list of selected files and uploads each one sequentially, creating Firestore metadata for each.
Can RapidDev help with advanced storage integrations?
Yes. RapidDev can implement multi-file uploads with progress tracking, file sharing with permissions, image compression before upload, S3 or Azure Blob integrations, and automated file processing pipelines.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation