# uploadFile

Uploads a file to the Selenium Standalone server or other browser driver (e.g. Chromedriver or EdgeDriver) by using the [`file`](https://webdriver.io/docs/api/selenium#file) command. *Note:* that this command is only supported if you use a Selenium Hub, Chromedriver or EdgeDriver directly.

**Note:** this command uses an un-official protocol feature that is currently only supported in Chrome and when running a [Selenium Grid](https://www.selenium.dev/documentation/en/grid/).

## Usage[​](#usage "Direct link to Usage")

```
await browser.uploadFile(localPath)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name        | Type     | Details            |
| ----------- | -------- | ------------------ |
| `localPath` | `string` | local path to file |

## Example[​](#example "Direct link to Example")

uploadFile.js

```
import path from 'node:path'

it('should upload a file', async () => {
    await browser.url('https://the-internet.herokuapp.com/upload')

    const filePath = '/path/to/some/file.png'
    const remoteFilePath = await browser.uploadFile(filePath)

    await $('#file-upload').setValue(remoteFilePath)
    await $('#file-submit').click()
});
```

## Returns[​](#returns "Direct link to Returns")

* **\<String>** **`return`:** remote URL
