Skip to main content

artifact_data_uri

Purpose: Convert a workflow File into a base64 data URI for use inside rendered HTML.

Syntax​

{{{artifact_data_uri file_reference}}}

Use three braces so the Text Replacement Engine does not HTML-escape the returned URI.

Parameters​

ParameterTypeRequiredDescription
file_referenceobjectYesA 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.