Skip to main content

artifact_data_uri

Purpose: Convert a File from your automation into a base64 data URI for use inside HTML, such as the HTML you turn into a PDF.

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 automation, 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 automation.
  • The file must still exist in automation history.
  • The file cannot exceed 50 MB.
  • Base64 encoding increases the size of the final HTML, so use only the images and files the output needs.