User Guide
138 Chapter 2: ColdFusion Tags
cffile action = "read"
Description
Reads a text file on the server. The file is read into a dynamic, local variable that you can use in
the page. For example:
• Read a text file; insert the file’s contents into a database
• Read a text file; use the find and replace function to modify the file’s contents
Note: This action reads the file into a variable in the local Variables scope. It is not intended for use
with large files, such as logs, because this can bring down the server.
Syntax
<cffile
action = "read"
file = "full_path_name"
variable = "var_name"
charset = "charset_option" >
See also
cfdirectory
History
See the History section of the main cffile tag page.
Attributes
Attribute Req/Opt Default Description
action Required Type of file manipulation that the tag performs.
file Required Pathname of the file to read.
If not an absolute path (starting a with a drive letter and a
colon, or a forward or backward slash), it is relative to the
ColdFusion temporary directory, which is returned by the
GetTempDirectory function.