> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchtoday.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# File Uploads

> Secure, resumable file uploads with S3 presigned URLs

## Overview

Launch includes a production-ready file upload system that supports:

* **Secure uploads** via S3 presigned URLs (no credentials exposed to client)
* **Resumable multipart uploads** for large files
* **Native background uploads** for iOS/Android (survives app backgrounding)
* **Parallel uploads** for multiple files
* **Progress tracking** with persistence across navigation

## Prerequisites

* S3 bucket and credentials
* Backend running with S3 env vars (copy from `apps/api/example.env`)
* File uploads feature enabled in `apps/mobile/features/feature-registry.tsx`

## Architecture

```
┌─────────────────────────────────────────────────────────────────┐
│                        Upload Flow                               │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│   Mobile App                    Backend API              AWS S3  │
│   ──────────                    ───────────              ──────  │
│                                                                  │
│   1. Select file ──────────────►                                 │
│                                                                  │
│   2. Request URL ──────────────► Validate user                   │
│                                  Check quota                     │
│                                  Generate presigned URL ◄──────► │
│                    ◄──────────── Return URL                      │
│                                                                  │
│   3. Upload file ──────────────────────────────────────────────► │
│                                                                  │
│   4. Confirm ──────────────────► Mark as uploaded                │
│                                  Update user storage             │
│                    ◄──────────── Success                         │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘
```

## Upload Strategies

Launch automatically selects the best upload strategy based on file size:

| File Size | Strategy              | Description                              |
| --------- | --------------------- | ---------------------------------------- |
| \< 10 MB  | **Simple Upload**     | Single presigned URL PUT request         |
| 10-40 MB  | **Multipart Upload**  | Chunked upload with 5MB parts, resumable |
| > 40 MB   | **Native Background** | iOS URLSession / Android coroutines      |

## Features

<CardGroup cols={2}>
  <Card title="Presigned URLs" icon="lock">
    Secure, time-limited URLs. No S3 credentials on client.
  </Card>

  <Card title="Resumable" icon="rotate">
    Multipart uploads can resume after network interruption.
  </Card>

  <Card title="Background Uploads" icon="mobile">
    Native iOS/Android uploads continue when app is backgrounded.
  </Card>

  <Card title="Progress Tracking" icon="chart-line">
    Per-file progress with UI persistence across navigation.
  </Card>
</CardGroup>

## Steps

1. Configure S3 and backend env vars: [Backend Setup](/file-uploads/backend-setup)
2. Integrate the mobile UI: [Mobile Setup](/file-uploads/mobile-setup)
3. Enable the feature flag:

`apps/mobile/features/feature-registry.tsx` → `featureFlags.fileUploads = true`

## How It Works

* Mobile requests presigned URLs from the API
* Uploads go directly to S3
* The API confirms and records uploads

## Quick Links

<CardGroup cols={2}>
  <Card title="Backend Setup" icon="server" href="/file-uploads/backend-setup">
    Configure S3, environment variables, and API endpoints.
  </Card>

  <Card title="Mobile Setup" icon="mobile" href="/file-uploads/mobile-setup">
    Integrate file uploads in your React Native app.
  </Card>

  <Card title="Native Uploads" icon="apple" href="/file-uploads/native-uploads">
    Deep dive into iOS/Android background upload module.
  </Card>

  <Card title="API Reference" icon="code" href="/file-uploads/api-reference">
    Complete API documentation for upload endpoints.
  </Card>
</CardGroup>

## Test Checklist

* Select a photo and upload successfully
* Large file triggers multipart or native upload
* Uploaded file appears in the list

## Troubleshooting

Start with [Troubleshooting](/troubleshooting) and verify S3 credentials and
CORS configuration.

## Remove / Disable

To disable uploads while you configure S3, set:

`apps/mobile/features/feature-registry.tsx` → `featureFlags.fileUploads = false`

For production removal guidance, see [Removing Features](/essentials/removing-features).

## Next Steps

* [Backend Setup](/file-uploads/backend-setup)
* [Mobile Setup](/file-uploads/mobile-setup)
