file

To return a specific file based on the file name from a given record

With this function, you can address a specific file attachment of a record, e.g. to display it in an image field or to send it as an attachment of an automatically generated e-mail.

Syntax

file(nid, string)

Return

file

Examples

file(record, fileName) To return a specific file based on the file name from a given record.

file(this,"INV-2021_13874.pdf")

Result: Returns the file “RE-2021_13874.pdf” from the current record.

See also

files, which returns all attachments of a record as an array.

importFile, which imports a file from a URL and saves it as an attachment of a record.

Last updated