Description
If you specify a file path, writes the entire content to the specified on-disk or in-memory file. If you specify a file object, writes text or binary data to the file object.
Category
Function syntax
FileWrite(filepath, data [, charset]) |
See also
FileCopy, FileDelete, FileExists, FileMove, cffile
History
ColdFusion 8: Added this function.
Parameters
Parameter |
Description |
---|---|
charset |
The character encoding in which the file contents is encoded. The following list includes commonly used values:
|
data |
Content of the file or file object to create. |
fileobj |
Name of the file object to write. |
filepath |
Pathname of the on-disk or in-memory file to write. If not an absolute path (starting 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. |
Usage
Use the following syntax to specify an in-memory file, which is not written to disk. In-memory files speed processing of transient data.
ram:///filepath |
The filepath can include directories, for example ram:///petStore/images/poodle.jpg. Create the directories in the path before you specify the file. For more information on using in-memory files, see Working with in-memory files in the Developing ColdFusion Applications.
Example
<h3>FileWrite Example</h3>
|