# File uploads

Accept images and PDFs with your form submissions. Files are checked by their contents and stored privately.

File uploads are available on Pro. Visitors can attach up to 5 files per submission, and you download them from the inbox.

## Turn on uploads

1. Open the form's **Settings** tab.
2. Under **Submissions**, turn on **Accept file uploads**.
3. Optionally change **Size limit per file**. The default is 10 MB.
4. Save.

In the [form builder](/docs/forms/builder), add a **File upload** field. The builder adds `enctype="multipart/form-data"` to the embed code for you. Without uploads turned on, the builder warns you that files would be dropped.

## Write the markup yourself

The form must send `multipart/form-data`:

```html
<form action="https://api.nisuform.com/s/YOUR_FORM_KEY" method="POST" enctype="multipart/form-data">
  <input type="email" name="email" required>
  <input type="file" name="attachment" accept="image/jpeg,image/png,image/webp,image/gif,application/pdf">
  <button type="submit">Send</button>
</form>
```

Use `multiple` or several file inputs to accept more than one file. With `fetch`, send a `FormData` object as the body and don't set `Content-Type` yourself.

## What is accepted

|                      | Limit                                          |
| -------------------- | ---------------------------------------------- |
| Files per submission | 5                                              |
| File types           | JPEG, PNG, WebP, GIF and PDF                   |
| Size per file        | Your **Size limit per file**, 10 MB by default |
| Whole request        | 25 MB, all files and fields together           |

The type is detected from the file's contents, not from its name or the type the browser reports. A renamed `.exe` is rejected even if it ends in `.pdf`.

Because the whole request is capped at 25 MB, a size limit per file above 25 MB has no extra effect.

## When a file is rejected

| Status | `error`                    | Cause                                                                     |
| ------ | -------------------------- | ------------------------------------------------------------------------- |
| `400`  | `too_many_files`           | More than 5 files.                                                        |
| `413`  | `attachment_too_large`     | A file is over the size limit per file.                                   |
| `413`  | `payload_too_large`        | The whole request is over 25 MB.                                          |
| `415`  | `attachment_type_rejected` | A file is not a JPEG, PNG, WebP, GIF or PDF.                              |
| `500`  | `upload_failed`            | Storing the file failed. Nothing was saved, so the visitor can try again. |

If uploads are off for the form, or the team is not on Pro, files are skipped and the rest of the submission is stored as usual. The request is then capped at 200 KB like any other submission, so a larger file gets `413` with `payload_too_large`.

## Download files

Open a submission in the inbox to see its files with their names, types and sizes. Selecting a file opens a private download link that expires after 15 minutes. Files are stored privately, are never public and always download as attachments.

Files are not included in [CSV exports](/docs/submissions/export), notification emails, webhooks or integrations. Those receive the other fields. Slack, Discord and Telegram messages link to the submission, where you can download the files.

Deleting a submission or a form deletes its files too.
