You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

read()

Usage

read(filepath)

Description
Returns the contents of a file underneath the Structr exchange/ directory. See Anatomy of a Structr application for more information.

Example

${read('helloworld.txt')}
${read('subdir/helloworld.txt')}

results in

Hello, world!

Note

  • The exchange/ directory itself may be a symbolic link
  • Underneath the exchange/ the canonical path of a file has to be identical to the provided filepath in order to prevent directory traversal attacks
    • This means that symbolic links inside the exchange/ directory are forbidden
    • Also path traversal is forbidden
      • Example 1: Allowed ‘sub/dir/file.txt’
      • Example 2: Forbidden ‘../../../../etc/passwd’
      • Example 3: Forbidden ‘/etc/passwd’

Search results for "read()"

read()

Returns the contents of a file underneath the Structr exchange/ directory. See Anatomy of a Structr application for more information.

read(filepath)