artifact_data_uri
Purpose: Convert a workflow File into a base64 data URI for use inside rendered HTML.
Syntax
Use three braces so the Text Replacement Engine does not HTML-escape the returned URI.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file_reference | object | Yes | A file reference from the current workflow, such as a form File field or the results of Generate PDF. |
Returns
The helper returns a string in this format:
data:content/type;base64,encoded-file-data
It uses the artifact's MIME content type. If the stored content type is invalid, it uses application/octet-stream.
Examples
Embed a form upload
For a File field named photo:
<img src="{{{artifact_data_uri input.photo}}}" alt="Submitted photo">
Embed an item from a Files field
<img src="{{{artifact_data_uri input.photos.[0]}}}" alt="First submitted photo">
Embed an action-generated file
For an earlier action whose results variable is chartImage:
<img src="{{{artifact_data_uri custom.chartImage}}}" alt="Generated chart">
Constraints
- The reference must identify a file from the current workflow.
- The file must still exist in workflow history.
- The file cannot exceed 50 MB.
- Base64 encoding increases the rendered HTML size, so use only the images and files the output needs.
Related Topics
- Generate PDF: render HTML containing artifact data URIs
- File Uploads in Forms: collect files from form visitors