File Contents expression – reading a file on the server¶
The file contents expression reads a file from the file system of the application server and returns its content – as text or Base64 encoded. It is meant for actions that work with files on the server, for example a file written by an earlier command.
1. At a glance¶
| Purpose | Returns the content of a file on the application server |
| Typical use | Reading a file an action has written to the temporary folder; reading a template from a folder of the server |
| Returns | Text |
| Related | System functions GetSystemTempFolderPath and GetSystemTempFileName (System functions) |
2. Settings¶
| Setting | Meaning | Default |
|---|---|---|
| "File Path" | An expression returning the full path of the file on the application server | – (required) |
| "As Base64" | Reads the file as bytes and returns them Base64 encoded – for binary files such as images or PDF documents | off – the file is read as text |
3. Behaviour¶
- The path is a path on the application server, read with the permissions of the account the nexxcite service runs under.
- This expression does not read attachments of records or files stored in nexxcite's own file storage.
- If the path is empty, the file does not exist or cannot be read, the result is empty. The reason is written to the application log.
- With several servers, the file must exist on the server that evaluates the expression.
4. Example¶
An action writes a CSV file into the temporary folder and stores its path in the variable "Export file". A later command attaches the file to a record; its content comes from a file contents expression with File Path = variable "Export file" and "As Base64" on.
5. Limitations¶
- The expression can read every file the service account can read. Consider who may edit expressions and actions in your installation.
- Large files are read completely into memory.