---
title: parseFormData
---

# parseFormData

<a href="https://github.com/remix-run/remix/blob/remix@3.0.0-alpha.6/packages/form-data-parser/src/lib/form-data.ts#L134" target="_blank">View Source</a>

## Summary

Parses a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) body into a [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData)
object. This is useful when accessing the data contained in a HTTP `multipart/form-data` request
generated by a HTML `<form>` element.

This is a drop-in replacement for [the built-in `request.formData()` API](https://developer.mozilla.org/en-US/docs/Web/API/Request/formData)
with the main difference being the ability to customize the handling of file uploads. Instead of
keeping all files in memory, the `uploadHandler` allows you to store the file on disk or a
cloud storage service.

## Signature

```ts
function parseFormData(
  request: Request,
  uploadHandler: FileUploadHandler,
): Promise<FormData>;

function parseFormData(
  request: Request,
  options: ParseFormDataOptions,
  uploadHandler: FileUploadHandler,
): Promise<FormData>;

```

## Params

### request

The `Request` object to parse

### options

Options for the parser

### uploadHandler

A function that handles file uploads. It receives a `File` object and may return any value that is valid in a `FormData` object