> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# Upload files (detailed)

> Set the files of a file input, without opening the file dialog. The files replace any the input already holds.

Set the files of a file input, without opening the file dialog. The files replace any the input already holds.

## Referenced In

* [upload](/reference/schemas/upload)

## Fields

| Field            | Type                                                                                                                                     | Description                                                                                                                                                                                                             | Default |
| :--------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------ |
| path             | one of: - string - array of string                                                                                                       | Required. File or files to set. A relative path resolves against the spec file, unless `relativePathBase` says otherwise. Use a list only for an input that accepts several files.                                      | —       |
| timeout          | integer                                                                                                                                  | Optional. Max duration in milliseconds to wait for the element to exist. `0` checks once. Minimum: 0                                                                                                                    | `5000`  |
| surface          | one of: - string - object([Browser surface](/reference/schemas/browser-surface)) - object([App surface](/reference/schemas/app-surface)) | Optional. The browser window or tab this step acts on. Omit to act on the active surface. Specifying a surface switches the active surface for the steps that follow. `upload` works only in a browser.                 | —       |
| elementText      | string                                                                                                                                   | Optional. Display text of the file input's label. If combined with other element finding fields, the element must match all specified criteria.                                                                         | —       |
| selector         | string                                                                                                                                   | Optional. Selector of the file input or its label. If combined with other element finding fields, the element must match all specified criteria.                                                                        | —       |
| elementId        | string                                                                                                                                   | Optional. ID attribute of the file input or its label. Supports exact match or regex pattern using /pattern/ syntax.                                                                                                    | —       |
| elementTestId    | string                                                                                                                                   | Optional. data-testid attribute of the file input or its label. Supports exact match or regex pattern using /pattern/ syntax.                                                                                           | —       |
| elementClass     | one of: - string - array of string                                                                                                       | Optional. Class or array of classes that the element must have. Each class supports exact match or regex pattern using /pattern/ syntax. Element must have all specified classes.                                       | —       |
| elementAttribute | object                                                                                                                                   | Optional. Object of attribute key-value pairs that the element must have. Values can be strings (supporting /pattern/ regex), numbers, or booleans. Boolean true matches attribute presence, false matches absence.     | —       |
| elementAria      | string                                                                                                                                   | Optional. Computed accessible name of the element per ARIA specification. Supports exact match or regex pattern using /pattern/ syntax.                                                                                 | —       |
| frame            | one of: - string - array of string                                                                                                       | Optional. Selector of the iframe that holds the element. Use a list for nested iframes, from the outer one to the inner one. The first match is used at each level. Applies to this step only. Works only in a browser. | —       |

## Examples

```json
{
  "selector": "#avatar",
  "path": "avatar.png"
}
```

```json
{
  "elementText": "Choose files",
  "path": [
    "a.pdf",
    "b.pdf"
  ]
}
```

```json
{
  "elementTestId": "resume",
  "path": "files/resume.pdf",
  "timeout": 10000
}
```