> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/guides/test-file-uploads-and-downloads.md).

# Test file uploads and downloads

DoesQA can create files inside a Flow, upload them into a file input, and reuse a file the browser just downloaded. You do not upload files from your laptop into the step.

```mermaid
flowchart TD
  open["Open upload page"] --> gen["Generate file or image"]
  gen --> file["File step Generated File"]
  file --> check["Check upload succeeded"]
```

Use the **Flow Builder** for this walkthrough.

## Upload a generated file

{% stepper %}
{% step %}

## Open the page

Start with [**Open**](/test-steps/starter/open.md). Point it at the page that has the upload control, or at the start of the journey that leads there.
{% endstep %}

{% step %}

## Generate the file

Add [**Generate file**](/test-steps/runner/generate-file.md) or [**Generate image**](/test-steps/runner/generate-image.md) from the [**Runner**](/test-steps/runner.md) family.

Set a **Filename**, choose the type, and fill the contents or image settings you need.
{% endstep %}

{% step %}

## Reach the upload control

Continue with [**Touch**](/test-steps/action/touch.md) and other steps until the file input is ready.
{% endstep %}

{% step %}

## Upload with File

Add [**File**](/test-steps/action/file.md).

1. Choose the file input [Element](/elements/creating-elements.md).
2. Set **File** to **Generated File**.
3. Pick the file you generated earlier in this Flow.
   {% endstep %}

{% step %}

## Confirm the upload

Add [**Check text**](/test-steps/check/check-text.md) or another Check that proves the application accepted the file.
{% endstep %}
{% endstepper %}

<figure><img src="/files/J2WSUbMfRA9E3lh4oJPX" alt="Generate file then File upload"><figcaption><p>Example generate-and-upload path</p></figcaption></figure>

## Reuse the last download

When the application downloads a file during the Run, later steps can use it.

1. Trigger the download with [**Touch**](/test-steps/action/touch.md) or another step.
2. Add [**File**](/test-steps/action/file.md) or [**Open file**](/test-steps/browser/open-file.md).
3. Set **File** to **Last Downloaded**.

[**Open file**](/test-steps/browser/open-file.md) opens that file in the browser. [**File**](/test-steps/action/file.md) uploads it into a file input.

{% hint style="info" %}
**Pro tip:** Generate the file in the same Flow (or [Step Group](/better-coverage/reuse-steps-with-step-groups.md)) that uploads it. The Generated File picker only lists files created earlier in that path.
{% endhint %}

## Related

* [File](/test-steps/action/file.md)
* [Open file](/test-steps/browser/open-file.md)
* [Generate file](/test-steps/runner/generate-file.md)
* [Generate image](/test-steps/runner/generate-image.md)
* [Choose durable selectors](/better-coverage/choose-durable-selectors.md)
* [Touch](/test-steps/action/touch.md)
