# Wait for Download

> `UiPath.Core.Activities.GetLastDownloadedFile`

`UiPath.Core.Activities.GetLastDownloadedFile`

Detects a file download initiated from any application and waits for the download to complete before any processing of the file is performed in the automation. Add the activity that starts the download inside this activity, specify the folder where the indicated application saves the downloaded file, and save the properties of the downloaded file to an output variable.

## Project compatibility

**Cross - Platform** | **Windows** | **Windows - Legacy**

## Cross - Platform Configuration

* **Body** - Add here the activity or activities that download the file.
* **Downloads folder** - The folder to watch for the downloaded file to be saved by the target application. By default, this is set as the user default download path.

**Properties**

**Input**
* **Timeout (Seconds)** - The time period to wait for the download to complete. By default, this is set to 300 seconds.
* **Ignore Files** - Specify which file extensions should be ignored until the download completes. Should you wish to specify several extensions, you can provide them inside a comma-separated list (e.g. "tmp,dwn"). This field supports only `Strings` and `String` variables.

**Output**
* **File Resource** - The `ILocalResource` variable used to refer to the downloaded file for later use in the automation.

## Windows, Windows - Legacy Configuration

* Add the activity or activities that download the file inside the **Activity to initiate the download** block.
* **Monitored folder** - Click **Browse**![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-image-browse_files-1431ef7d.png) next to the field and then browse to and select the folder where the application or web browser from which the file is downloaded saves the file. By default, the Downloads folder for the current Windows user is selected.
* **Downloaded file** - Name of the downloaded file.
* **Ignore these temporary file extensions** - In **StudioX**, you can use the **Plus**![docs image](https://dev-assets.cms.uipath.com/assets/images/activities/activities-image-plus_menu-8e75b25b.png) icon to select one of the available options:

## In the Properties Panel

#### **Options**

* **DisplayName** - The display name of the activity.
* **Downloads folder** - The folder where the application or web browser from which the file is downloaded saves the file. By default, the Downloads folder for the current Windows user is selected.
* **Ignore file extensions** - Specify which file extensions should be ignored until the download completes. Should you wish to specify several extensions, you can provide them inside a comma-separated list (e.g. "tmp,dwn"). This field supports only `Strings` and `String` variables.
* **FileResource** - An OutArgument of the `ILocalResource` type.
* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.
* **Timeout** - Specify a time period for which to wait for the download to complete. The default value is 300 seconds. Increase the value if the file takes longer to download.

#### **Output**

* **Downloaded file** - The properties of the downloaded file. This field supports FileInfo variables.

## Example of using this activity:

1. Add a [Use Application/Browser](https://docs.uipath.com/activities/other/latest/ui-automation/n-application-card) activity and indicate the desktop application or web browser from which to download the file.
2. Add a Wait for Download activity inside Use Application\\Browser.
3. Inside Wait for Download, add the activity that initiates the file download (for example, a [Click](https://docs.uipath.com/activities/other/latest/ui-automation/click) activity that clicks a download button in the application interface).
4. In the **Downloads Folder** field of the Wait for Download activity, specify the folder where the indicated application saves the file (by default, the Downloads folder for the current Windows user). The activity checks this folder and waits for the file download to complete.

**To make sure the file download works as expected:**

* Do not download multiple files at once.
* Add only the activity that starts the file download inside this activity. For example, if you need to use three [Click](https://docs.uipath.com/activities/other/latest/ui-automation/click) activities to download a file from a web page, add the [Use Application/Browser](https://docs.uipath.com/activities/other/latest/ui-automation/n-application-card) activity, and then, inside it:
  1. Add the first two Click activities.
  2. Add the Wait for Download activity.
  3. Add the final Click activity that initiates the download inside Wait for Download.
* Make sure that you specify the **Downloads folder** correctly. If the indicated application saves the file in a subfolder of this folder, the download is not detected by the activity.
* Make sure that the specified **Downloads folder** doesn't contain temporary files created by other applications, such as Microsoft Office apps. The **Wait for Download** activity may mistake these files for downloaded files.
* Increase the **Timeout** value for downloads that take longer to complete.

To learn how to use this activity, create a new project based on the **Download File from Website** [project template](https://docs.uipath.com/studiox/docs/project-templates).
