# How to build file sharing in Bubble

- Tool: Bubble
- Difficulty: Beginner
- Time required: 20-25 min
- Compatibility: All Bubble plans
- Last updated: March 2026

## TL;DR

Build a file sharing platform in Bubble with file upload, shareable link generation with optional expiry and password protection, access control for public and private files, and download tracking. This lets users securely share files with anyone while maintaining control over access.

## Overview: Building a File Sharing Platform in Bubble

This tutorial shows you how to build a secure file sharing platform in Bubble. You will create data types for files and share links, build upload functionality, generate shareable URLs with optional password protection and expiry dates, track downloads, and let file owners manage their shared files.

## Before you start

- A Bubble account with an existing app
- Basic understanding of Bubble data types and workflows
- Familiarity with File Uploader element and URL parameters
- Knowledge of Privacy Rules basics

## Step-by-step guide

### 1. Create the file sharing data types

Go to the Data tab and create: SharedFile with fields: owner (User), file (file), filename (text), description (text), file_size (text), upload_date (date). ShareLink with fields: shared_file (SharedFile), access_code (text — unique generated code), password (text — optional), expiry_date (date — optional), is_active (yes/no), download_count (number, default 0), max_downloads (number — optional limit).

**Expected result:** SharedFile and ShareLink data types exist with all access control fields.

### 2. Build the upload and share interface

Create a page called my-files. Add a File Uploader and Input fields for filename and description. The upload workflow creates a SharedFile record. Below, add a Repeating Group showing the user's files. Each cell has a Share button that opens a popup where the user can set: password (optional), expiry date (optional), and max downloads (optional). On share, create a ShareLink with a generated access_code (use a random string or truncated unique ID) and the configured options.

**Expected result:** Users can upload files and generate share links with configurable access controls.

### 3. Create the download page

Create a page called download that reads the access_code from a URL parameter. On page load, search for ShareLink where access_code = URL parameter code and is_active = yes. If not found, show File not found. If found but expired (expiry_date < Current date), show Link expired. If password-protected, show a password input. On correct password, reveal the Download button. The download workflow opens the file URL and increments download_count. If max_downloads is set and reached, set is_active = no.

**Expected result:** Anyone with the share link can download the file, subject to password, expiry, and download limit controls.

### 4. Add file management for owners

On the my-files page, add management controls: a toggle to deactivate share links (set is_active = no), a delete button for removing files entirely, and a stats view showing download_count per share link. For each file, show all its ShareLinks in an expandable section. Let owners revoke access to any share link at any time. For enterprise file sharing with team folders and audit logs, consider working with RapidDev.

**Expected result:** File owners can manage, monitor, and revoke access to their shared files.

## Complete code example

File: `Workflow summary`

```text
FILE SHARING PLATFORM — WORKFLOW SUMMARY
==========================================

DATA TYPES:
  SharedFile: owner, file, filename, description, file_size, upload_date
  ShareLink: shared_file, access_code, password, expiry_date, is_active, download_count, max_downloads

SHARE URL FORMAT:
  https://yourapp.com/download?code=[access_code]

WORKFLOW 1: Upload file
  Action: Create SharedFile (owner=Current User, file=Uploader's value)

WORKFLOW 2: Generate share link
  Action 1: Create ShareLink
    access_code = generated unique string
    password = Input Password's value (if set)
    expiry_date = Date Picker's value (if set)
    is_active = yes
  Action 2: Display the share URL

WORKFLOW 3: Download file
  Page: download?code=[access_code]
  Check 1: ShareLink exists and is_active = yes
  Check 2: Not expired (expiry_date >= Current date or empty)
  Check 3: Password matches (if set)
  Check 4: download_count < max_downloads (if set)
  Action 1: Open file URL
  Action 2: Increment download_count
  Action 3: If max_downloads reached → is_active = no

WORKFLOW 4: Revoke access
  Action: Make changes to ShareLink (is_active = no)
```

## Common mistakes

- **Using predictable access codes** — Sequential or short codes can be guessed, allowing unauthorized access to shared files Fix: Generate access codes using a long random string or a combination of the unique ID and a timestamp.
- **Not checking expiry dates on the download page** — Expired links continue to work, defeating the purpose of setting an expiry Fix: Check expiry_date on page load and show an expired message if the current date is past the expiry.
- **Not setting Privacy Rules on SharedFile** — Without rules, any user can search for and access all uploaded files via the API Fix: Add Privacy Rules so only the file owner can find their files in searches. ShareLinks should be findable by access_code for the download page.

## Best practices

- Generate long, random access codes for share links
- Add optional password protection for sensitive files
- Set expiry dates on share links for time-limited access
- Track download counts for usage monitoring
- Allow file owners to revoke share links at any time
- Use Privacy Rules to protect files from unauthorized API access
- Set file type and size restrictions on the uploader

## Frequently asked questions

### What is the maximum file size?

Bubble allows uploads up to 50MB on paid plans. For larger files, integrate with AWS S3 or Google Cloud Storage via the API Connector.

### Can I share files with non-users?

Yes. The download page uses the access_code URL parameter and does not require login. Anyone with the link can access the file (subject to password/expiry restrictions).

### How do I add folder organization?

Create a Folder data type with name, owner, and parent_folder fields. Link SharedFiles to folders and build a folder navigation UI.

### Can RapidDev help build an enterprise file sharing platform?

Yes. RapidDev specializes in Bubble development and can build enterprise file sharing with team permissions, audit trails, version control, and external storage integration.

### Are uploaded files encrypted?

Bubble stores files on AWS with encryption at rest (AES-256). Files in transit use HTTPS. For additional security, consider encrypting files before upload.

---

Source: https://www.rapidevelopers.com/bubble-tutorial/create-a-file-sharing-platform-in-bubble
© RapidDev — https://www.rapidevelopers.com/bubble-tutorial/create-a-file-sharing-platform-in-bubble
