#FlutterFlow File Upload to #Supabase Storage Bucket - Walkthrough

Quick Overview

The video demonstrates how to implement a FlutterFlow application that uploads PDF files to a Supabase Storage Bucket, stores the file path in a PostgreSQL table using a user ID filter, and then renders the PDF using a PDF Viewer widget, all while ensuring Row Level Security (RLS) policies restrict access to authenticated users only within their respective folders.

Key Points: The application successfully uploads a PDF file to a private folder within a Supabase Storage Bucket named 'uploads' via an action flow. The backend call action ensures that only the authenticated user's ID is stored in the database along with the file's path. The database query for the list view is filtered by 'userid' equal to the 'Authenticated User -> User ID' to display only the current user's uploaded files. The order of records in the list view is set to be based on 'createdat' in descending order, showing the newest uploads first. The PDF Viewer widget is configured to use a Network Path source, dynamically pointing to the stored file path from the database query result. RLS policies are implemented on the 'uploads' table, specifically granting authenticated users access (SELECT, INSERT, UPDATE, DELETE) only to files within folders named after their user ID, ensuring data isolation.

Context: This tutorial walks through setting up a file upload feature in a FlutterFlow application that integrates with Supabase for both file storage and database management. The core requirement is securely uploading PDF files, storing metadata (like the path and user ID) in the database, and then displaying the PDF content within the app using a PDF Viewer widget, all while maintaining user-specific data segregation using Supabase Row Level Security (RLS).

Detailed Analysis

The tutorial details the construction of a file upload system using FlutterFlow and Supabase. The initial step involves setting up the UI on the mobile simulator (iPhone 14 Pro) with a button to trigger the file selection. Upon selecting a PDF file, an action flow is triggered when the 'Upload File' button is pressed. This flow first invokes the 'Upload file to Supabase' action, specifying the 'uploads' bucket and the 'private' folder path, which is dynamically constructed using the authenticated user's ID in the policy definition (02:54). A conditional check ensures that the upload was successful (i.e., the 'Uploaded File URL' is not empty) before proceeding (11:25). If successful (TRUE path), a Backend Call (Insert Row) action inserts a new record into the 'upload' table, saving the authenticated user's ID and the file's path (12:17). This is followed by a 'Refresh Database Request' to update the list view (12:56). The list view component ('PageScrollableColumn') is configured to query the 'upload' table, filtered by 'userid' matching the current authenticated user's ID, and ordered by 'createdat' descending (07:34). Finally, the PDF Viewer widget is configured to load the PDF from the 'path' field returned by the database query (13:24). The video emphasizes the importance of Supabase RLS policies, which dictate that authenticated users only have permissions to access files within folders named after their user ID within the 'private' folder of the 'uploads' bucket (05:05).

Raw markdown version of this recap