> To build a Wix site agentically, or add Wix features like bookings or a store to a site you already have, follow https://www.wix.com/headless/skill.md
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: FileUpload Component

## Article: FileUpload Component

## Article Link: https://dev.wix.com/docs/wix-design-system/components/form/file-upload-component.md

## Article Content:

# FileUpload

_Components/Form_

Interactive docs page: <https://wix-pages.com/design-system-documentation/#/component/fileupload>

## Overview

```jsx
() => (
  <Box align="center">
    <Box direction="vertical" width={'50%'}>
      <FileUpload multiple onChange={() => {}}>
        {({ openFileUploadDialog }) => (
          <AddItem
            onClick={openFileUploadDialog}
            icon="generic_add_item_illustration.svg"
            size="large"
          >
            Upload Files
          </AddItem>
        )}
      </FileUpload>
    </Box>
  </Box>
);
```

File upload allows users to upload one or multiple files at once. This wrapper opens a native upload dialog box when the user clicks a trigger.

### Do

- Let users upload all types of text or media files.
- Let users upload one or more files at once.
- Use it to add a file type selection to existing components like `<AddItem/>`.

### Don't

- Don't use it as a standalone item. It must always wrap a trigger component. For a standalone solution, use `<FilePicker/>` instead.

### Feature examples

#### Basic structure

A trigger component must be added, so that users can open the upload dialog box. This trigger is defined as a child item of `FileUpload`.

```jsx
<FileUpload onChange={() => {}}>
  {({ openFileUploadDialog }) => (
    <Button onClick={openFileUploadDialog} prefixIcon={<Icons.UploadExport />}>
      Upload File
    </Button>
  )}
</FileUpload>;
```

#### File type selection

Select which types of files can be uploaded with the `accept` prop. The file types are separated by a comma.

```jsx
<StorybookComponents.Stack>
  <FileUpload accept=".jpeg,.gif,.png" onChange={() => {}}>
    {({ openFileUploadDialog }) => (
      <Button
        prefixIcon={<Icons.UploadExport />}
        onClick={openFileUploadDialog}
      >
        Upload Image
      </Button>
    )}
  </FileUpload>
  <FileUpload accept=".doc,.pdf" onChange={() => {}}>
    {({ openFileUploadDialog }) => (
      <Button
        prefixIcon={<Icons.UploadExport />}
        onClick={openFileUploadDialog}
      >
        Upload Document
      </Button>
    )}
  </FileUpload>
</StorybookComponents.Stack>;
```

#### Multiple files upload

Let users upload multiple files at once using the `multiple` prop.

```jsx
<FileUpload multiple onChange={() => {}}>
  {({ openFileUploadDialog }) => (
    <Button onClick={openFileUploadDialog} prefixIcon={<Icons.UploadExport />}>
      Upload Files
    </Button>
  )}
</FileUpload>;
```

### Developer examples

#### Mobile considerations - Capture

`capture` tells `FileUpload` to open a device camera flow (mobile) instead of a regular picker.

- `"user"` (default) opens the front-facing camera.
- `"environment"` opens the rear-facing camera.
- `"none"` disables camera capture and uses the regular file picker.

**Desktop always opens the standard file picker.**

```jsx
() => {
  const [lastSelection, setLastSelection] = React.useState('No file selected');

  const handleChange = (files) => {
    const firstFile = files && files[0];
    setLastSelection(firstFile ? firstFile.name : 'No file selected');
  };

  return (
    <Box gap="20px" direction="vertical">
      <Box gap="12px">
        <FileUpload accept="image/*" capture="user" onChange={handleChange}>
          {({ openFileUploadDialog }) => (
            <Button onClick={openFileUploadDialog}>
              Capture (front camera)
            </Button>
          )}
        </FileUpload>

        <FileUpload
          accept="image/*"
          capture="environment"
          onChange={handleChange}
        >
          {({ openFileUploadDialog }) => (
            <Button onClick={openFileUploadDialog}>
              Capture (rear camera)
            </Button>
          )}
        </FileUpload>

        <FileUpload accept="image/*" capture="none" onChange={handleChange}>
          {({ openFileUploadDialog }) => (
            <Button onClick={openFileUploadDialog}>Upload from device</Button>
          )}
        </FileUpload>
      </Box>
    </Box>
  );
};
```

### Common use case examples

#### Upload files

Any library component can be used to open an upload dialog box. Nevertheless, it's better to use buttons or viewer components that have predefined interaction states and can be accessed with the keyboard (for accessibility reasons).

```jsx
<FileUpload multiple accept=".jpeg,.gif,.png" onChange={() => {}}>
  {({ openFileUploadDialog }) => (
    <AddItem
      size="large"
      subtitle="Only JPEG, GIF and PNG files up to 5 MB are supported."
      onClick={openFileUploadDialog}
    >
      Upload Media
    </AddItem>
  )}
</FileUpload>;
```

#### Add images

To let users add images, set `<ImageViewer/>` as the trigger component.

```jsx
<FileUpload multiple accept=".jpeg,.gif,.png" onChange={() => {}}>
  {({ openFileUploadDialog }) => (
    <ImageViewer onAddImage={openFileUploadDialog} />
  )}
</FileUpload>;
```

#### Add attachments

Let users attach files to messages, emails or contact details with the `<Button/>` or `<TextButton/>` components.

```jsx
() => {
  const renderAddFileButton = (
    <FileUpload multiple onChange={() => {}}>
      {({ openFileUploadDialog }) => (
        <TextButton
          size="small"
          onClick={openFileUploadDialog}
          prefixIcon={<Icons.Add />}
        >
          Attach File
        </TextButton>
      )}
    </FileUpload>
  );

  return (
    <Layout>
      <Cell span={6}>
        <Card>
          <Card.Content>
            <Box direction="vertical" gap={2}>
              <Box
                width="100%"
                align="space-between"
                marginBottom={4}
                verticalAlign="middle"
              >
                <Text size="medium" secondary weight="bold">
                  Attachments
                </Text>
                {renderAddFileButton}
              </Box>
              <Box align="space-between" verticalAlign="middle">
                <Box gap={2}>
                  <Icons.Attachment />
                  <Text secondary>CV.pdf</Text>
                </Box>
                <PopoverMenu
                  textSize="small"
                  triggerElement={
                    <Tooltip content="More actions">
                      <IconButton priority="secondary" size="small">
                        <Icons.MoreSmall />
                      </IconButton>
                    </Tooltip>
                  }
                >
                  <PopoverMenu.MenuItem
                    text="Download"
                    prefixIcon={<Icons.DownloadImportSmall />}
                  />
                  <PopoverMenu.MenuItem
                    text="Delete"
                    prefixIcon={<Icons.DeleteSmall />}
                  />
                </PopoverMenu>
              </Box>
              <Box align="space-between" verticalAlign="middle">
                <Box gap={2}>
                  <Icons.Attachment />
                  <Text secondary>Contract.pdf</Text>
                </Box>
                <PopoverMenu
                  textSize="small"
                  triggerElement={
                    <Tooltip content="More actions">
                      <IconButton priority="secondary" size="small">
                        <Icons.MoreSmall />
                      </IconButton>
                    </Tooltip>
                  }
                >
                  <PopoverMenu.MenuItem
                    text="Download"
                    prefixIcon={<Icons.DownloadImportSmall />}
                  />
                  <PopoverMenu.MenuItem
                    text="Delete"
                    prefixIcon={<Icons.DeleteSmall />}
                  />
                </PopoverMenu>
              </Box>
            </Box>
          </Card.Content>
        </Card>
      </Cell>
    </Layout>
  );
};
```

## Code

```jsx
import { FileUpload } from '@wix/design-system';
```

### Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `accept` | `string` | — | Defines which file types to accept (i.e. .jpeg, .gif, .png). Each format should be separated by a comma. |
| `capture` | `"none" \| "user" \| "environment"` | ``user`` | Specifies that a new file should be captured and which camera to use to capture the image or video data. `Use user` for the user-facing camera and `environment`  for the outward-facing camera. ##### Note: This only works on mobile devices; If your device is a desktop computer, you'll get a standard file picker. |
| `children` *(required)* | `(params: FileUploadChildrenProps) => ReactNode` | — | Accepts any kind of component as a child item that calls out the file picker. ##### Syntax: function({ openFileUpload }): element * `openFileUpload`: A function that opens a file upload dialog when triggered. * return: A react element |
| `dataHook` | `string` | — | Applies a data-hook HTML attribute that can be used in tests. |
| `multiple` | `boolean` | `false` | Allows you to select and upload multiple files at once. |
| `name` | `string` | — | Specifies a form data name to be submitted along with the control value. |
| `onChange` *(required)* | `(files: FileList \| null) => void` | — | Defines a standard input onChange callback. |

## Testkit

Import the driver matching your test environment:

```jsx
// UniDriver
import { FileUploadUniDriver } from '@wix/design-system/dist/testkit/unidriver';

// Vanilla
import { FileUploadTestkit } from '@wix/design-system/dist/testkit';

// Puppeteer
import { FileUploadTestkit } from '@wix/design-system/dist/testkit/puppeteer';

// Testing Library
import { FileUploadTestkit } from '@wix/design-system/dist/testkit/testing-library';
```

### Driver methods

| Method | Description |
| --- | --- |
| `exists` | Checks whether the component found with the given data hook. |
| `element` | Gets the component root element. |
| `click` | Clicks on the component root element. |
| `base` | Returns UniDriver for the base element. |

## Changelog

- **1.340.0** (2026-10-21) — maintenance release, no component-specific changes
- **1.339.0** (2026-10-19) — maintenance release, no component-specific changes
- **1.338.0** (2026-10-15) — maintenance release, no component-specific changes
- **1.330.3** (2026-09-29) — maintenance release, no component-specific changes
- **1.330.0** (2026-09-28) — maintenance release, no component-specific changes
- **1.325.0** (2026-09-17) — maintenance release, no component-specific changes
- **1.310.0** (2026-08-10) — maintenance release, no component-specific changes
- **1.292.0** (2026-06-22) — maintenance release, no component-specific changes
- **1.289.0** (2026-06-17) — maintenance release, no component-specific changes
- **1.260.0** (2026-03-17) — fix: remove default "user" value from capture prop ([#15991](invalid-url))
- **1.254.0** (2026-02-03) — maintenance release, no component-specific changes
- **1.228.0** (2025-11-18) — maintenance release, no component-specific changes
- **1.189.1** (2025-05-16) — fix: reset file upload input value to allow re-uploading the same file ([#14864](invalid-url))
- **1.151.0** (2025-01-07) — maintenance release, no component-specific changes
- **1.138.1** (2024-10-30) — maintenance release, no component-specific changes
- **1.115.0** (2024-07-17) — maintenance release, no component-specific changes
- **1.92.1** (2024-02-05) — maintenance release, no component-specific changes