Skip to content

File storage and media

Where should your app keep files that people upload?

Put each file somewhere your app can find it again, and decide who should be allowed to open it. A receipt needs a private download. A product photo might need a small copy for a public listing. The job the file has to do tells you which service to compare.

Do you need storage, an upload button or a media service?

Follow one file through your app. If an expense app needs to keep a receipt, start with a private place for the original. If people need progress and retries on a file picker, look at an upload service. If a shop needs three sizes of each product photo, look at image processing.

One provider can cover several of these jobs. If your app already has a place to keep files, try its private upload and download flow before adding a separate service. For video, decide whether people need a downloadable file or a player that can adapt playback to a slower connection. A video service can prepare that second experience. A media library helps a team find and organize originals when many people reuse them.

How can you tell whether a private upload really stays private?

Use a small PDF that you made yourself and two disposable accounts in an isolated test app. Use a private storage location you control. The test passes when the owner can open the file after reloading and the second account cannot get a download.

Anyone holding a valid temporary download link may be able to use it. Testing whether the second account can get a link is different from pasting a link the first account already has. Use invented data and keep those links out of logs and public messages.

  1. Save a sample receipt
    Upload as the first account. Reload its expense page and open the same file. Verify the app saved the link between the receipt and the right account.
  2. Check what another account can get
    Sign in as the second account in a fresh browser session. Try to open the receipt through the app. It should reveal neither the file nor a link that downloads it. If the app has a preview, check that it stays private too.
  3. Check the ordinary address
    If the provider exposes a plain file address, try it while signed out. Private files should not open that way. If the app uses temporary links, verify that an authorized request works and a fresh request after expiry is denied.
  4. Check one rejected upload
    Try a harmless file outside the allowed size or type. The app should explain what to change and leave no usable attachment on the expense. Clean up any disposable files left over.

Compare tools

Scroll the table sideways to read every column.

Compare services for storing, uploading and delivering files
ToolWhat it handlesThe file job it can do for your app.What you set upThe work needed for a first upload or display.Who can open itWhat to configure for private files or previews.What the bill countsThe units to check before comparing plans.What you can moveHow to take the originals and their references with you.
Amazon S3Keep original files, such as receipts or exports.Create a private bucket. Connect uploads and save each file key in your app.Your app checks ownership before it gives out a temporary download link.GB-month of storage, requests, and applicable data transfer.Copy original files and export the app’s file-to-account records separately.
UploadThingGive your app an upload button with hosted file handling.Connect one upload rule for file type, size, count and permission. Save the resulting file key.File URLs are public by default. Paid private files use temporary signed links.Monthly storage tier. The free allowance is shared across apps.List and download the files you need, and keep your app’s file references.
CloudinaryMake and deliver crops, thumbnails and larger copies of an original image.Upload one source image. Decide which crop and size each page should show.Authenticated delivery protects originals and variants. Private delivery protects only the original by default.Shared credits for stored space, transformations and delivery.Download originals and keep the rules used to make the resized copies.

What should your app check before accepting a file?

Choose the smallest set of file types and sizes that does the job. A receipt form might need a PDF or photo. Give people a clear message when a file is too large, while having your app or storage service enforce the actual limits.

A file’s name and the type reported by the browser do not establish what is inside it. Check what was received before letting staff open it or exposing it to others. For untrusted uploads, your developer may need a private holding area and a scan for harmful files. If uploads will appear on a public page, decide who or what reviews the content before it goes live. Let the uploader see whether the file is still being checked, was accepted or needs to be replaced.

Why can a small file library still get expensive?

A bill can grow because you keep many copies, receive many requests or send the same file to many people. A resized image also costs something to create on some plans. Estimate those uses separately before comparing prices.

If one photo is 2 MB and 500 visitors each download it once, the photo alone sends about 1 GB of data. That is an estimate of transfer, and the provider decides how it is billed. The original still takes only 2 MB to store.

What to count before choosing a plan
If your app does thisEstimate this
Keeps originals and older versionsHow much space you use and how long you need to keep it.
Shows a lot of thumbnailsHow many sizes you create and how often visitors request them.
Lets people download filesHow large the files are and how much data goes out.
Moves files to another providerThe time and charges to copy a sample set, then all the originals.

Why can a restored database still show broken file links?

Your database might remember which receipt belongs to an expense without keeping the PDF itself. If the database and files are stored separately, recovering the database can restore that reference while the file is still missing.

Before moving providers or deleting accounts, decide what has to move with each file. That may include the owner, the file key, permissions and how to rebuild any previews. Practise with an isolated copy and keep a recoverable set of originals before deleting anything you need.

What to recover in a test copy
What you restoreWhat to check after recovery
App recordsThe right expense still points to the right stored file.
Original filesYou can open a sample and it matches the original you backed up.
Access rulesThe owner can open it and the other account cannot.
Previews and resized versionsRestore them or use recorded settings to make them again.

Related guides

  1. 1

    Set up a private avatar with Supabase

    Follow a private image upload and use a second account to test who can read it.