A file manager in Bubble uses a Folder Data Type supporting nested hierarchy and a File Data Type for uploaded documents. This tutorial covers building the folder tree with parent-child relationships, implementing file uploads with drag-and-drop, adding rename, move, and delete operations, displaying file type icons, and tracking storage usage per user.
Overview: File Manager in Bubble
This tutorial shows you how to build a file management interface where users can organize files into folders, upload new files, and perform basic file operations like rename, move, and delete.
Prerequisites
- A Bubble app on any plan
- Basic understanding of Data Types and File Uploads
- Familiarity with Repeating Groups and Workflows
- Understanding of parent-child data relationships
Step-by-step guide
Design the file manager data model
Design the file manager data model
Create two Data Types. 'Folder' with fields: name (text), parent_folder (Folder — self-referencing for nesting), owner (User), and path (text — for breadcrumb display like '/Documents/Projects'). 'UserFile' with fields: name (text), file (file), folder (Folder), owner (User), file_type (text — pdf, image, doc, etc.), and file_size (number — in bytes). The self-referencing parent_folder field enables nested folder hierarchies.
Expected result: Folder and UserFile Data Types support nested folder structures with file metadata.
Build the folder navigation sidebar
Build the folder navigation sidebar
Create a two-panel layout: a sidebar showing the folder tree and a main area showing folder contents. In the sidebar, display root-level folders using a Repeating Group of Folders where parent_folder is empty and owner is Current User. Each folder row shows a folder icon, the folder name, and an expand arrow. When a folder is clicked, set a custom state 'current_folder' to the clicked folder. For sub-folders, add a nested Repeating Group inside each cell that searches for Folders where parent_folder equals the current cell's Folder. Add a breadcrumb trail above the main content showing the folder path.
Expected result: A sidebar displays navigable folders with expandable sub-folders and breadcrumb navigation.
Display folder contents and handle file uploads
Display folder contents and handle file uploads
In the main content area, add two Repeating Groups. First, show sub-folders of the current folder (Do a Search for Folder where parent_folder = current_folder). Second, show files (Do a Search for UserFile where folder = current_folder). Display each file with an appropriate icon based on file_type, the file name, size formatted as KB/MB, and the upload date. Add a File Uploader element and an Upload button. When Upload is clicked, create a new UserFile with the uploaded file, extract the file name and type from the file URL, and set the folder to current_folder.
Pro tip: Parse the file extension from the uploaded file URL to automatically set the file_type field for icon display.
Expected result: The main panel shows folder contents and users can upload files to the current folder.
Implement file operations
Implement file operations
Add right-click context menu or action buttons for each file and folder. For Rename: show an inline Input that replaces the name text, save on Enter or blur. For Move: open a popup with a folder tree selector, then Make changes to UserFile setting folder to the selected destination. For Delete: show a confirmation popup, then Delete the UserFile record. For Download: use the Open an external website action targeting the file's URL. For New Folder: show an Input popup, create a new Folder with parent_folder = current_folder.
Expected result: Users can rename, move, delete, and download files, and create new folders.
Track and display storage usage
Track and display storage usage
Add a storage indicator at the top or bottom of the file manager. Calculate total storage used: Do a Search for UserFile where owner = Current User, then sum the file_size field. Display as 'X MB of Y MB used' with a progress bar. Set a storage limit per user based on their plan or a fixed value. Before file upload, check if the new file would exceed the limit and show a warning if so. For the progress bar, use a Group with dynamic width set to (used_storage / total_limit * 100) percent.
Expected result: Users see their current storage usage and remaining capacity with a visual progress bar.
Complete working example
1FILE MANAGER SYSTEM SUMMARY2=====================================34DATA MODEL:5 Folder: name, parent_folder (self-ref), owner, path6 UserFile: name, file, folder, owner, file_type,7 file_size89LAYOUT:10 Sidebar: Folder tree (nested RGs)11 Root: parent_folder is empty12 Children: parent_folder = current13 Main: Contents of current_folder14 Sub-folders RG + Files RG15 Breadcrumb: folder path display16 Storage bar: usage / limit1718FILE OPERATIONS:19 Upload: File Uploader → Create UserFile20 Parse extension for file_type21 Set folder = current_folder22 Rename: Inline Input → Make changes23 Move: Folder picker popup → Change folder24 Delete: Confirm popup → Delete thing25 Download: Open external website (file URL)26 New Folder: Input popup → Create Folder27 parent_folder = current_folder2829FILE TYPE ICONS:30 pdf → document icon (red)31 jpg/png → image icon (blue)32 doc/docx → word icon (blue)33 xls/xlsx → spreadsheet icon (green)34 other → generic file icon (gray)3536STORAGE TRACKING:37 Total used: Search UserFiles → sum file_size38 Display: X MB of Y MB used39 Progress bar: width = used/limit %40 Upload check: reject if exceeds limitCommon mistakes when building a File Manager in Bubble
Why it's a problem: Not implementing the folder hierarchy with self-referencing parent_folder
How to avoid: Use a self-referencing Folder field (parent_folder of type Folder) to support unlimited nesting levels
Why it's a problem: Deleting a folder without deleting its contents
How to avoid: Before deleting a folder, recursively delete all files and sub-folders inside it using a backend workflow
Why it's a problem: Not tracking file sizes on upload
How to avoid: Store the file size when creating the UserFile record and use it for storage calculations
Best practices
- Use self-referencing Folder data type for flexible nesting
- Parse file extensions automatically to set type icons
- Track file sizes for storage monitoring and limits
- Implement confirmation dialogs for delete operations
- Show breadcrumb navigation for easy folder path context
- Recursively delete contents when deleting folders
- Set storage limits per user to manage app storage costs
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to build a file manager in Bubble.io with folders, sub-folders, file upload, and basic operations like rename, move, and delete. How should I design the data model?
Help me build a file management system with a folder tree sidebar, file listing with upload capability, and operations for rename, move, and delete. Include storage usage tracking.
Frequently asked questions
How much file storage does Bubble provide?
Storage varies by plan: Free gets 0.5GB, Starter 10GB, Growth 100GB, and Team 1TB. Files are stored on AWS S3.
Can users share files or folders?
Yes. Add a 'shared_with' (list of Users) field to Folder and UserFile Data Types. Modify searches to include items shared with the Current User.
Is there a maximum file size for uploads?
Bubble supports file uploads up to 50MB per file. For larger files, use an external storage service like AWS S3 directly.
Can I preview files without downloading?
Images can be displayed directly using Image elements. PDFs can be previewed using an HTML element with an iframe pointing to the file URL. Other formats typically require downloading.
How do I handle duplicate file names?
Before creating a UserFile, check if a file with the same name exists in the current folder. If so, append a number suffix like 'document (1).pdf'.
Can RapidDev help build a file management system?
Yes. RapidDev can build advanced file managers in Bubble with sharing, permissions, version control, and integration with external storage services.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation