Skip to main content

Files

Files allow you to create, edit, and share data between steps in a workflow. Once a file is available as a file variable, subsequent steps can reference its identifier, path, or size. Files are available only during the current workflow execution. They are deleted when the execution ends.

File Object

Each file variable contains a file object with three properties: For instructions on passing a file path to a Python script, see Using a File in Python Code.

Expression Language and Variable Picker Support

You can reference files through the variable picker or Blink’s Expression Language.

Using the Variable Picker

  1. Open the variable picker and expand the files section.
  2. Select the file variable you want to use. In the example below, the variable is named WorkingDirectory.
File variables in the variable picker
  1. Choose the property required by the action: File Identifier, File Path, or File Size. For the example variable, these appear as WorkingDirectory|identifier, WorkingDirectory|path, and WorkingDirectory|size.
Selecting a file variable property

Using Expressions

Use the get_file() function in Blink’s Expression Language to retrieve a file variable by name. To access a specific property, add .identifier, .path, or .size to the expression:
Replace WorkingDirectory with the name of the file variable you want to use.
Accessing a file property with an expression
To retrieve the complete file object, including its identifier, path, and size, use:
File object returned by get_file

Files Uploaded Through Input Parameters and Web Forms

When a workflow receives a file through a File input parameter or a Web Form trigger, the uploaded file is automatically available as a file variable for that execution. The file variable uses the field’s Parameter Name and contains the same identifier, path, and size properties described above. For example, if the field’s Parameter Name is report, use the following expressions: You can also select the uploaded file and its properties under the files section of the variable picker.
Uploaded files are available only for the duration of the workflow execution and are deleted when it ends. To retain a file, send it to another system, such as cloud storage or a ticketing platform, before the execution finishes.

Optional File Fields

If a file field is not marked as Required, users can leave it empty. When no file is uploaded, no file variable is created for that field during the execution. Any step that tries to access the missing file, either through an expression such as {{get_file("report").path}} or through the variable picker, fails with the following error:
To handle this:
  • If the workflow requires the file: Mark the file field as Required.
  • If the file is optional: Add a condition so that steps referencing the file run only when a file was provided. This includes any step that retrieves the file’s path before passing it to another step.

Using a File in Python Code

The Run Python action does not evaluate expressions such as {{get_file("report").path}} or variables inserted from the variable picker inside its code block. These remain literal text in the script. To access a file in Python, first resolve its path in a step that supports expressions, then retrieve that step’s output through the context object.
  1. Output the file path in a preceding step. For example, add a Run Bash Script step with the following code:
    This outputs the resolved file path without a trailing newline. Replace report with the file field’s Parameter Name.
  2. Read the file in the Python step. If the preceding Bash step is S1, use:
    Replace S1 with the identifier of the step that outputs the file path. This example opens the file in binary mode and stores its contents in data.

When Is a Working Directory Needed?

A Working Directory preserves files and changes between workflow steps configured to use that directory. Whether you need one depends on how you use the file:
  • You want to access an existing file variable: Files uploaded through input parameters or web forms, and files created by Download File From URL, are already available as file variables. Access their paths using {{get_file("name").path}}, replacing name with the file variable’s name. You do not need a working directory or Set File Variable to access these files.
  • Your script creates a file that a later step needs: Add a Create Working Directory action, select that directory in the script step, and save the file there. Then use Set File Variable with the same Working Directory to make the file available as a file variable for subsequent steps.
  • Your script processes an existing file and you need to preserve the result: Select a working directory in the script step and save the new or updated file there. Then use Set File Variable with the same working directory to make the result available to subsequent steps.

Limitations

The following limits apply to each workflow execution: GiB stands for gibibytes.

Example Use Cases