User Guide

Chapter 1: ColdFusion Tags 55
<CFOUTPUT>#Message#</CFOUTPUT>
ColdFusion supports a number of powerful functions for manipulating the contents of
text files. You can also use variable created by a CFFILE Read operation in ArrayToList
and ListToArray functions.
See String Functions and Array Functions for more information about working with
strings and arrays.
CFFILE ACTION="ReadBinary"
You can use the CFFILE tag to read an existing binary file, such as an executable or
image file. The file is read into a binary object parameter you can use anywhere in the
page like any other parameter. If you would like to send it through one of the Web
protocols, such as HTTP or SMTP, or store it in a database, you should first convert it to
Base 64 (see To B a s e6 4 ).
Syntax <CFFILE ACTION="ReadBinary"
FILE="full_path_name"
VARIABLE="var_name">
FILE
Required. The full path name of the file to be read.
VARIABLE
Required. The name of the variable that will contain the contents of the binary file
after it has been read.
Example The following example creates a variable named "aBinaryObj " that will contain the
ColdFusion Server executable.
<CFFILE ACTION="ReadBinary"
FILE="c:\cfusion\bin\cfserver.exe"
VARIABLE="aBinaryObj">
You can then convert the binary file to Base 64 so that you could FTP it to another site
for upload.
CFFILE ACTION="Write"
You can use the CFFILE tag to write a text file based on dynamic content. For example,
you could create static HTML files from this content or log actions in a text file.
Syntax <CFFILE ACTION="Write"
FILE="full_path_name"
OUTPUT="content"
MODE="permission"
ADDNEWLINE="Yes/No"
ATTRIBUTES="file_attributes">