Download File

In this section, we will guide you on how to use the Download File block.

Use Cases

This is a highly useful block for downloading images, videos, PDFs, Excel, CSV, and other files from web pages.

download-file

How It Works

You need to specify the file link, which is usually extracted from the page using Set Variables or Extract Data. You can also specify a custom file name; if left blank, the name from the URL will be applied.

basic-use

Custom File Names

You can customize the file name format using Template Syntax. Tapicker parses the file URL and stores the file name and extension in the internal variables _filename and _ext, respectively. If these variables are included in the new file name, they will automatically be replaced with the corresponding values.

Examples

Assume the file URL is as follows:

https://www.example.com/image.png

The internal variables parsed would be _filename = image and _ext = png.

Example 1: Use a random ID for the name

{{@funcs.getRandomId(8)}}._ext // a3201620.png

Example 2: Add a uniform prefix

test._filename._ext // test.image.png

Example 3: Create a new folder

This is relative to the browser’s download location.

./folder/_filename._ext // ./folder/image.png

Example 4: Create a folder based on the date

./{{@funcs.getDate()|format("YYYY-MM-DD")}}/_filename._ext // ./2024-10-28/image.png

Batch Download

To enable batch downloading, you should use this block with the Loop block, like so:

batch-download