228
To create a form in which to enter data for a text file:
1.
Open a new file in Studio.
2.
Modify the file so that it appears a follows:
<HTML>
<HEAD>
</HEAD>
<BODY>
<H2>Put Information into a Text File</H2>
<FORM ACTION="writetextfileaction.cfm" METHOD="POST">
NAME="FileName" SIZE="25">
</FORM>
</BODY>
</HTML>
3.
Save the file as
To write a text file:
1.
Open a new file in Studio.
2.
Modify the file so that it appears as follows:
<HTML>
<HEAD>
</HEAD>
<BODY>
<CFFILE ACTION="Write"
</BODY>
</HTML>
3.
Modify the path
4.
Save the file as
5.
View the file
the form.
The text file is written to the location you specified.
You can use
existing text file, for example, when creating log files.
<TITLE>Put Information into a Text File</TITLE>
<p>Enter you name: <INPUT TYPE="text" NAME="Name" SIZE="25">
<p>Enter you the name of the file: <INPUT TYPE="text"
<p>Enter your message:</p>
<INPUT TYPE="textarea" NAME="message"cols=45 rows=6>
</p>
<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
writetextfileform.cfm
<TITLE>Untitled</TITLE>
FILE="C:\inetpub\wwwroot\mine\#form.filename#"
OUTPUT="Created By: #Form.Name#
#Form.Message# ">
C:\inetpub\wwwroot\mine\
writetextfileaction.cfm
writetextfileform.cfm
CFFILE ACTION="Append"
Developing Web Applications with ColdFusion
in
under the Web root directory
myapps
to point to a path on your server.
.
in your browser, enter values, and submit
to append additional text to the end of an
.
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers