How do I upload and store files?
Last checked 31 Aug 2026
Short answer
Ask Lovable to add file uploads and it will wire up storage in Lovable Cloud (or your connected Supabase project), including an upload UI and access policies for the files.
How storage works
Lovable Cloud includes storage alongside its database, authentication and edge functions. Files (images, documents, PDFs, etc.) are kept in storage buckets, separate from your Postgres tables, with their own access rules.
Setting it up
- Describe what you need in chat rather than the mechanics:
Let users upload a profile photo. Store it in Cloud storage and show it on their profile page.
- Lovable creates a storage bucket, an upload component, and access policies controlling who can read/write files in that bucket.
- For anything sensitive (private documents, ID uploads), specify that explicitly so the bucket isn't left public.
Public vs private buckets
- Public buckets — anyone with the file's URL can view it. Fine for things like public product images or avatars.
- Private buckets — access is checked per request, similar to RLS on a table. Use these for anything user-specific or confidential.
Make the "documents" bucket private so only the uploading user can download their own files
Referencing files from your database
Store the file's path or URL in a normal table column, so you can query and display it like any other data — Lovable will typically set this up automatically when you ask for an upload feature tied to a record (e.g. a document attached to an order).
What usually goes wrong
- A bucket left public by default when the content should be private — always specify sensitivity when asking for the feature.
- Large files without any size/type validation, leading to slow uploads or unexpected file types.
- Forgetting storage counts toward your Cloud usage — very large media libraries are worth planning for rather than discovering later.
See also /questions/how-do-i-back-up-my-lovable-database and /questions/how-do-i-safely-store-api-keys.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I back up my Lovable database?Lovable Cloud stores backups you can restore from directly in the Database screen; for extra safety, also ask Lovable to export your data periodically.
- AnswerHow do I connect Supabase to Lovable?In your Lovable project, open the Supabase integration and authorise Lovable to connect to an existing Supabase project (or create a new one), then Lovable can read and write to it the same way it does with Lovable Cloud.
- AnswerHow do I safely store API keys?Store keys as secrets in your backend (Lovable Cloud/Supabase) and call the third-party API from a server/edge function — never put keys in front-end code.
- AnswerHow do I view my database data?Open the Cloud tab (or ask Lovable) to browse tables, edit rows and run SQL directly inside your project — no separate Supabase login needed.