ColdFusion FileWrite() - How to write the content of a file

FileWrite() - write the content of a file

FileWrite.cfm


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FileWrite function example: how to write the content of a file</title>
</head>

<body>
<h2 style="color:Crimson">FileWrite Function Example</h2>

<cfset MyFile="C:\ReadMe.txt">
<cfset FileWrite(MyFile,"The text is writen by FileWrite function","utf-8")>

<cfset FileText=FileRead(MyFile,"utf-8")>
<cfoutput>
<b>File:</b> #MyFile#
<br />
<b>File Text:</b> #FileText#
</cfoutput>

</body>
</html>


More ColdFusion example