220
Developing Web Applications with ColdFusion
Using CFFILE
The CFFILE tag gives you the ability to work with files on your server in a number of
ways:
•
Uploading files from a client to the Web server using an HTML form.
•
Moving, renaming, copying, or deleting files on the server.
•
Reading, writing, or appending to text files on the server.
The required attributes depend on the ACTION specified. For example, if
ACTION="WRITE", ColdFusion expects the attributes associated with writing a text
file.
Note
Consider the security and logical structure of directories on the server
before allowing users access to them.
Uploading Files
File uploading requires that you create two files:
•
An HTML form to enter file upload information
•
An action page containing the file upload code
To create an HTML file to specify file upload information:
1.
Create a new file in Studio.
2.
Modify the file so that it appears as follows:
<HTML>
<HEAD>
<TITLE>Specify File to Upload</TITLE>
</HEAD>
<BODY>
<H2>Specify File to Upload</H2>
<FORM ACTION="uploadfileaction.cfm"
4
ENCTYPE="multipart/form-data"
METHOD="post">
<P>Enter the complete path and filename of the file to upload:
<INPUT TYPE="file"
NAME="FiletoUpload"
SIZE="45">
</P>
<INPUT TYPE="submit"
VALUE"Upload">
</FORM>
</BODY>
</HTML>
3.
Save the file as
uploadfileform.cfm
in
myapps
under the Web root directory.
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...