Skip to main content
Version: 1.28 (Current)

Save File

Audience: Low-code Engineers

Skill Prerequisites: Tokens, HTTP basics

Saves a file to a portal folder. The file's contents can come from three sources:

  • Url: the file is downloaded from a URL with an HTTP GET request.
  • Text: the text you provide, which can contain tokens, is saved as the file.
  • Base64: a Base64 string in Data URI format (for example data:image/png;base64,iVBOR...) is decoded and saved.

Details of the saved file, such as its URL and file ID, can be saved as tokens for use by the actions that follow.

note

Older documentation called this action Save file to disk, its Content Source parameter Input mode, and its Base64 option Base64 image. The Base64 option accepts any file type, not just images.

Typical Use Cases​

  • Download a file from an external API or web address and store it on the site
  • Save a signature or drawing captured in the browser as a Base64 image
  • Write generated text such as CSV, JSON, XML or HTML to a file
  • Save the output of a report service before emailing it or uploading it with Upload to FTP

Don't use it to​

Action NameDescription
Server RequestCalls an HTTP endpoint with any method, headers and body.
Get or Create FolderCreates the destination folder and returns its path as a token.
Unpack an archiveExtracts a downloaded archive.
Upload to FTPUploads the saved file to an FTP server.

Input Parameter Reference​

ParameterDescriptionSupports TokensDefaultRequired
Content SourceWhere the file's contents come from: Url, Text or Base64.NoUrlYes
UrlUrl only. The address of the file to download. A GET request is sent to this URL.Yesempty stringYes
HeadersUrl only. Extra HTTP headers to send with the request, as name and value pairs, for example Authorization = Bearer [ApiToken]. Both names and values support tokens.YesemptyNo
ContentText and Base64 only. For Text, the contents of the file. For Base64, a Data URI string such as data:application/pdf;base64,JVBERi0x....Yesempty stringYes
FolderThe portal folder to save the file in. Select a folder, or in expression mode enter a folder path relative to the portal root, or a folder ID. When a path is given, missing folders are created.Yesnone selectedYes
Filename PatternThe name for the saved file, for example [User:Username]-signature. How the extension is chosen depends on the content source. See How the file name is chosen. Leave empty to use a name from the server's response or a random name.Yesempty stringNo
Allowed ExtensionsUrl and Base64 only. A list of allowed file types, chosen from the site's MIME types. If the downloaded or decoded file's type isn't in the list, the action fails and nothing is saved. Leave empty to allow any type.NoemptyNo
Handle DuplicatesWhat happens if a file with the same name already exists in the folder. Rename saves the new file with a unique suffix added to its name. Overwrite replaces the existing file.NoRenameYes

Output Parameters Reference​

Each output is optional. Enter a token name in the ones you need.

ParameterDescription
Absolute URL Output Token NameToken that receives the file's absolute URL, for example https://example.com/Portals/0/Signatures/jdoe-signature.png.
Relative URL Output Token NameToken that receives the file's URL relative to the site root, for example /Portals/0/Signatures/jdoe-signature.png.
Physical Path Output Token NameToken that receives the file's physical path on the server.
Link Click Output Token NameToken that receives a LinkClick URL that downloads the file.
File Id Output Token NameToken that receives the file ID.

How the file name is chosen​

Content SourceNameExtension
TextFilename Pattern, or a random name if empty.The extension in Filename Pattern. If there isn't one, .txt is used.
UrlFilename Pattern, or else the file name in the response's Content-Disposition header, or else a random name.Taken from the response's Content-Type header. If there's no Content-Type, taken from the Content-Disposition file name, then from the URL, and finally .txt. An extension in Filename Pattern is ignored.
Base64Filename Pattern, or a random name if empty.Always taken from the MIME type in the Data URI. An extension in Filename Pattern that doesn't match is replaced.

Considerations​

  • Failed downloads. If the URL returns an HTTP error status, for example 404 or 500, the action fails and the status is written to the site's event log.
  • Allowed file extensions. The file's extension must be in the site's list of allowed file extensions, otherwise saving fails.
  • Text encoding. Text content is saved as UTF-8.
  • Security. Only download from URLs you trust, and don't save untrusted content into public folders. Use Allowed Extensions to block unexpected file types.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Download a file from an API that needs a bearer token​

This action downloads an invoice PDF from an external API, sends an Authorization header, allows only PDF files, and saves the file as Invoices/INV-<InvoiceNumber>.pdf. The file ID is saved in the InvoiceFileId token.

{
"Title": "Save File",
"ActionType": "SaveFileToDisk",
"Description": "Download the invoice PDF",
"Condition": null,
"Parameters": {
"InputMode": {
"Expression": "",
"Value": "Url",
"IsExpression": false,
"Parameters": {}
},
"Url": "https://api.example.com/invoices/[InvoiceNumber]/pdf",
"Headers": {
"Authorization": "Bearer [ApiToken]"
},
"Content": "",
"Folder": {
"Expression": "Invoices",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"Pattern": "INV-[InvoiceNumber]",
"AllowedExtensions": [
{
"MimeType": ".pdf"
}
],
"Duplicates": {
"Expression": "",
"Value": "Overwrite",
"IsExpression": false,
"Parameters": {}
},
"AbsoluteURLOutputTokenName": "",
"RelativeURLOutputTokenName": "",
"PhysicalPathOutputTokenName": "",
"LinkClickOutputTokenName": "",
"FileIdOutputTokenName": "InvoiceFileId"
}
}

2. Save a CSV file from text​

This action writes a small CSV file built from tokens to Exports/contact-<Id>.csv and saves its absolute URL in the CsvUrl token.

{
"Title": "Save File",
"ActionType": "SaveFileToDisk",
"Description": "Write a CSV file",
"Condition": null,
"Parameters": {
"InputMode": {
"Expression": "",
"Value": "Text",
"IsExpression": false,
"Parameters": {}
},
"Url": "",
"Content": "Name,Email\n[FirstName] [LastName],[Email]",
"Folder": {
"Expression": "Exports",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"Pattern": "contact-[Id].csv",
"Duplicates": {
"Expression": "",
"Value": "Rename",
"IsExpression": false,
"Parameters": {}
},
"AbsoluteURLOutputTokenName": "CsvUrl",
"RelativeURLOutputTokenName": "",
"PhysicalPathOutputTokenName": "",
"LinkClickOutputTokenName": "",
"FileIdOutputTokenName": ""
}
}

3. Save a signature captured as a Base64 image​

This action saves the Base64 PNG in the Signature field as Signatures/<Username>-signature.png. The extension comes from the Data URI.

{
"Title": "Save File",
"ActionType": "SaveFileToDisk",
"Description": "Save the signature image",
"Condition": null,
"Parameters": {
"InputMode": {
"Expression": "",
"Value": "Base64",
"IsExpression": false,
"Parameters": {}
},
"Url": "",
"Content": "[Signature]",
"Folder": {
"Expression": "Signatures",
"Value": "",
"IsExpression": true,
"Parameters": {}
},
"Pattern": "[User:Username]-signature",
"Duplicates": {
"Expression": "",
"Value": "Overwrite",
"IsExpression": false,
"Parameters": {}
},
"AbsoluteURLOutputTokenName": "",
"RelativeURLOutputTokenName": "SignatureUrl",
"PhysicalPathOutputTokenName": "",
"LinkClickOutputTokenName": "",
"FileIdOutputTokenName": ""
}
}

Revised 09/25/2026