---
title: "FileUpload"
source: "https://github.com/remix-run/remix/blob/8905f3943706e1f53696ab83e70a84873cabfc90/packages/form-data-parser/src/lib/form-data.ts#L43"
---

# FileUpload

## Summary

A file that was uploaded as part of a `multipart/form-data` request.

The `name` and `type` properties are untrusted client input from the submitted multipart metadata;
they do not validate the file contents. The `name` is not sanitized for filesystem use and must
not be used directly as a filesystem path, including on files returned in `FormData`. Generate
storage names and validate file contents in your upload handler before using files in
application-specific contexts.

## Signature

```ts
interface FileUpload {
  fieldName: string
  lastModified: number
  name: string
  size: number
  type: string
  webkitRelativePath: string
  arrayBuffer(): Promise<ArrayBuffer>
  bytes(): Promise<Uint8Array<ArrayBuffer>>
  slice(start: number, end: number, contentType: string): Blob
  stream(): ReadableStream<Uint8Array<ArrayBuffer>>
  text(): Promise<string>
}

```

## Properties

### `fieldName`

The name of the `<input>` field used to upload the file.

### `lastModified`

The **`lastModified`** read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified)

### `name`

The **`name`** read-only property of the File interface returns the name of the file represented by a File object. For security reasons, the path is excluded from this property.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name)

### `size`

The **`size`** read-only property of the Blob interface returns the size of the Blob or File in bytes.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size)

### `type`

The **`type`** read-only property of the Blob interface returns the MIME type of the file.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type)

### `webkitRelativePath`

The **`webkitRelativePath`** read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an <input> element with its webkitdirectory attribute set.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/File/webkitRelativePath)

## Methods

### `arrayBuffer(): Promise<ArrayBuffer>`

The **`arrayBuffer()`** method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer)



### `bytes(): Promise<Uint8Array<ArrayBuffer>>`

The **`bytes()`** method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/bytes)



### `slice(start: number, end: number, contentType: string): Blob`

The **`slice()`** method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice)



### `stream(): ReadableStream<Uint8Array<ArrayBuffer>>`

Returns a stream of the file's contents.



### `text(): Promise<string>`

The **`text()`** method of the Blob interface returns a Promise that resolves with a string containing the contents of the blob, interpreted as UTF-8.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text)

