Parameter
Description
Appends text or contents of an object to an in-memory text file.
You can also use this function as an alternative to the cffile tag with the action="append" attribute.
Returns
Void.
Category
Function Syntax
FileAppend(file, data[, charset, addNewLine])
See also
History
ColdFusion (2018 release) Update 4, ColdFusion (2016 release) Update 11: Added support for this function.
Parameters
|  | Required (Yes/No) | Description | 
|---|---|---|
| file | Yes | An absolute path to an on-disk or in-memory text file on the server. | 
| data | Yes | The file object or string from which to read. | 
| charset | No | The character encoding in which the file contents is encoded. The following list includes commonly used values: 
 | 
| addNewLine | No | Boolean value that indicates whether a new line is to be added to the contents of the file. | 
Example
<cfscript> 
    theDir=GetDirectoryFromPath(GetCurrentTemplatePath()) 
    theFolder=theDir & "file.txt" 
    fileData="The quick brown fox jumps over the lazy dog." 
    FileAppend(file=theFolder,data=fileData,charset="UTF-8",addNewLine="yes") 
</cfscript>
		
	
In the snippet above, the parameter addNewLine adds the information that is specified in the parameter data. As many times you run this snippet, the information gets added as a new line in the output file.