Title: FormFileUpload
Published: March 9, 2021
Last modified: October 14, 2026

---

# FormFileUpload

## In this article

 * [Props](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#props)
    - [accept](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#accept)
    - [children](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#children)
    - [icon](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#icon)
    - [multiple](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#multiple)
    - [onChange](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#onchange)
    - [onClick](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#onclick)
    - [render](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#render)

See the [WordPress Storybook](https://wordpress.github.io/gutenberg/?path=/docs/components-formfileupload--docs)
for more detailed, interactive documentation.

FormFileUpload allows users to select files from their local device.

    ```language-jsx
    import { FormFileUpload } from '@wordpress/components';

    const MyFormFileUpload = () => (
      <FormFileUpload
        accept="image/*"
        onChange={ ( event ) => console.log( event.currentTarget.files ) }
      >
        Upload
      </FormFileUpload>
    );
    ```

## 󠀁[Props](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#props)󠁿

### 󠀁[accept](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#accept)󠁿

 * Type: `string`
 * Required: No

A string passed to the `input` element that tells the browser which
 [file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers)
can be uploaded by the user. e.g: `image/*,video/*`.

### 󠀁[children](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#children)󠁿

 * Type: `ReactNode`
 * Required: No

Children are passed as children of `Button`.

### 󠀁[icon](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#icon)󠁿

 * Type: `IconType | null`
 * Required: No

The icon to render in the default button.

See the `Icon` component docs for more information.

### 󠀁[multiple](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#multiple)󠁿

 * Type: `boolean`
 * Required: No
 * Default: `false`

Whether to allow multiple selection of files or not.

### 󠀁[onChange](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#onchange)󠁿

 * Type: `ChangeEventHandler<HTMLInputElement, HTMLInputElement> | undefined`
 * Required: Yes

Callback function passed directly to the `input` file element.

Select files will be available in `event.currentTarget.files`.

### 󠀁[onClick](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#onclick)󠁿

 * Type: `MouseEventHandler<HTMLInputElement>`
 * Required: No

Callback function passed directly to the `input` file element.

This can be useful when you want to force a `change` event to fire when
 the user
chooses the same file again. To do this, set the target value to an empty string
in the `onClick` function.

    ```language-jsx
    <FormFileUpload
      onClick={ ( event ) => ( event.target.value = '' ) }
      onChange={ onChange }
    >
      Upload
    </FormFileUpload>
    ```

### 󠀁[render](https://developer.wordpress.org/block-editor/reference-guides/components/form-file-upload/?output_format=md#render)󠁿

 * Type: `((arg: { openFileDialog: () => void; }) => ReactNode)`
 * Required: No

Optional callback function used to render the UI.

If passed, the component does not render the default UI (a button) and
 calls this
function to render it. The function receives an object with property `openFileDialog`,
a function that, when called, opens the browser native file upload modal window.

First published

March 9, 2021

Last updated

October 14, 2026

Edit article

[ Improve it on GitHub: FormFileUpload ](https://github.com/WordPress/gutenberg/edit/trunk/packages/components/src/form-file-upload/README.md)

[  Previous: FontSizePicker](https://developer.wordpress.org/block-editor/reference-guides/components/font-size-picker/)

[  Next: FormToggle](https://developer.wordpress.org/block-editor/reference-guides/components/form-toggle/)