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

# File Uploads

> Accept file uploads with your forms

FormBnB supports file uploads with secure S3-compatible storage.

## Enable File Uploads

1. Go to your form settings
2. Enable "Allow File Uploads"
3. Configure allowed file types and max size

## HTML Form

Use `enctype="multipart/form-data"`:

```html theme={null}
<form 
  action="https://api.formbnb.com/f/YOUR_ORG/YOUR_FORM" 
  method="POST"
  enctype="multipart/form-data"
>
  <input type="text" name="name" placeholder="Name" required>
  <input type="email" name="email" placeholder="Email" required>
  
  <label for="resume">Upload Resume (PDF, max 10MB)</label>
  <input type="file" id="resume" name="resume" accept=".pdf" required>
  
  <button type="submit">Submit Application</button>
</form>
```

## Multiple Files

```html theme={null}
<input type="file" name="attachments" multiple>
```

## React Example

```tsx theme={null}
function ApplicationForm() {
  const [status, setStatus] = useState('idle');

  async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
    e.preventDefault();
    setStatus('loading');

    const form = e.currentTarget;
    const data = new FormData(form);

    const response = await fetch('https://api.formbnb.com/f/YOUR_ORG/YOUR_FORM', {
      method: 'POST',
      body: data, // Don't set Content-Type header - browser sets it with boundary
      headers: { 'Accept': 'application/json' }
    });

    setStatus(response.ok ? 'success' : 'error');
  }

  return (
    <form onSubmit={handleSubmit}>
      <input type="text" name="name" required />
      <input type="email" name="email" required />
      <input type="file" name="resume" accept=".pdf" required />
      <button disabled={status === 'loading'}>Submit</button>
    </form>
  );
}
```

## Settings

| Setting       | Default                      | Description              |
| ------------- | ---------------------------- | ------------------------ |
| Max File Size | 10 MB                        | Maximum size per file    |
| Allowed Types | `image/*`, `application/pdf` | MIME types or extensions |

### Allowed File Types Examples

```
image/*                    # All images
application/pdf            # PDF files
.doc,.docx                 # Word documents
image/png,image/jpeg       # Specific image types
```

## Storage Quota

Each plan has a storage limit:

| Plan     | Storage |
| -------- | ------- |
| Free     | 100 MB  |
| Pro      | 1 GB    |
| Business | 10 GB   |

View your usage in Account Settings.

## Accessing Files

Files are stored securely and accessible via signed URLs. In the dashboard:

1. Go to form submissions
2. Click on a submission with files
3. Click the file to download

Via API, file URLs are included in the submission data:

```json theme={null}
{
  "data": {
    "name": "John Doe",
    "email": "john@example.com"
  },
  "files": [
    {
      "id": "file_abc123",
      "filename": "resume.pdf",
      "originalName": "John_Doe_Resume.pdf",
      "mimeType": "application/pdf",
      "size": 245678,
      "url": "/api/files/file_abc123"
    }
  ]
}
```

## Security

* Files are stored in S3-compatible storage
* URLs are signed and expire after 1 hour
* File type validation on upload
* Virus scanning (Business plan)
