> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# addFile

> Push a file onto the device.

Pushes a file from the host onto the device at a target location. There is no
simplified form. `path` and `location` are required.

## Parameters

| Parameter  | Type      | Required | Description                                                 |
| ---------- | --------- | -------- | ----------------------------------------------------------- |
| `path`     | `string`  | Yes      | Path to the file on the host. May be a local path or URL.   |
| `location` | `string`  | Yes      | Destination on the device. See the platform notes below.    |
| `saveAs`   | `string`  | No       | Variable to store this step's return value on `env.<name>`. |
| `retries`  | `number`  | No       | Times to retry the step on failure before failing the test. |
| `skipped`  | `boolean` | No       | Skip this step at execution time.                           |

## Location

`location` is interpreted differently on each platform.

### Android

`location` is an absolute file path on the device. Put media under a
media-scanned directory (e.g. `/sdcard/Pictures`, `/sdcard/Download`) so it
shows up in the gallery.

```yaml theme={null}
- addFile:
    path: ./fixtures/avatar.png # source on the host
    location: /sdcard/Download/avatar.png # destination on the device
```

### iOS

`location` is either a bare filename or an app-container path:

* **Photos**: a plain filename with no parent directories (keep the real image
  or video extension). The file is imported into the iOS Photos library, i.e.
  the camera roll the system photo picker reads from. Only images and videos are
  supported here.
* **App container**: the `@<bundle-id>:data/<path-inside-container>` form writes
  the file into the app's private data container. Use this for non-media files
  (e.g. PDFs) and anything the app reads from its own storage. `<bundle-id>`
  must be an app installed on the device (the one you `openApp`).

  iOS files generally belong under `Documents/` (e.g.
  `@<bundle-id>:data/Documents/file.pdf`). iOS only exposes the app's
  `Documents/` directory to the Files app and most apps only read user files
  from there, so a file written to the container root (e.g.
  `@<bundle-id>:data/file.pdf`) usually won't show up in the app. Use another
  subdirectory only if the app you're testing reads from a different location.

```yaml theme={null}
# Import an image into Photos
- addFile:
    path: ./fixtures/avatar.png
    location: avatar.png

# Write a PDF into the app's Documents directory
- addFile:
    path: ./fixtures/contract.pdf
    location: "@com.example.app:data/Documents/contract.pdf"
```

## Related

* [YAML format](/docs/core-concepts/test-format)
* [Files integration](/docs/integrations/files)
