webCOMAND

#OUTPUT

Create or update a file with the given filename and data.  A path to the file is returned.

Syntax

#OUTPUT($filename, $data, $mode = 'write')

Parameters

  • filename - A simple filename or path. An absolute file path (starts with a slash) will create the file under the Publish Path.  A relative file path will create the file under the Publication Procedure path.  This default behavior can be customized with #PATHFROM and #PATHTYPE.
  • data - Data may contain either text or binary information to output as the contents of the file.
  • mode - Optional file write mode.  Default is "write" or "w", which creates a file if one does not already exist, or replaces the file if it does exist.  "append" or "a" creates a file if one does not exist, or appends to it if it exists.  "overwrite" or "o" will force-overwrite an existing file.

Return

A relative path to the file is returned, unless a different path was configured with #PATHTO or #PATHTYPE.

Example

<a href="#OUTPUT("test.txt","Test Text")">Link</a>
#PATHBASE("/")
<a href="#OUTPUT("test.txt","Test Text")">Link</a>
#ENDPATHBASE

Result

<a href="test.txt">Link</a>
<a href="current/publish/path/test.txt">Link</a>

Related

#NOOUTPUT, #PATHFROM, #PATHTO, #PATHTYPE