Using Cffile; Uploading Files - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

220

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

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>
</HEAD>
<BODY>
<H2>Specify File to Upload</H2>
<FORM ACTION="uploadfileaction.cfm"
4
ENCTYPE="multipart/form-data"
<P>Enter the complete path and filename of the file to upload:
</P>
</FORM>
</BODY>
</HTML>
3.
Save the file as
Consider the security and logical structure of directories on the server
before allowing users access to them.
<TITLE>Specify File to Upload</TITLE>
METHOD="post">
<INPUT TYPE="file"
NAME="FiletoUpload"
SIZE="45">
<INPUT TYPE="submit"
VALUE"Upload">
uploadfileform.cfm
Developing Web Applications with ColdFusion
in
under the Web root directory.
myapps

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents