Contents > Developing ColdFusion MX Applications > Managing Files on the Server > Using cffile > Reading, writing, and appending to a text file Appending a text file PreviousNext

Appending a text file

You can use cffile to append additional text to the end of a text file; for example, when you create log files.

To append a text file:

  1. Open the writetextfileaction.cfm file.
  2. Change the value for the action attribute from write to append so that the file appears as follows:
    <html>
    <head>
       <title>Append a Text File</title>
    </head>
    <body>
    <cffile action="append"
       file="C:\inetpub\wwwroot\mine\message.txt"
       output="Appended By: #Form.Name#">
    </body>
    </html>
    
  3. Save the file as writetextfileaction.cfm in the myapps directory under your web_root.
  4. View the file in the browser, enter values, and submit the form.

    The appended information displays at the end of the text file.


Contents > Developing ColdFusion MX Applications > Managing Files on the Server > Using cffile > Reading, writing, and appending to a text file Appending a text file PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.