Resolving Conflicting File Names; Controlling The Type Of File Uploaded - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

222
3.
Change the following line to point to an appropriate location on your server:
DESTINATION="c:\inetpub\wwwroot\HR\"
4.
Save the file as
5.
View
6.
The file you specified is uploaded.
Code Review
Code
<CFFILE ACTION="UPLOAD"
DESTINATION="c:\inetpub\wwwroot\HR\"
Note

Resolving conflicting file names

When a file is saved to the server, there is a risk that another file may already exist with
the same name. In the event of this occurrence, there are a number of actions you can
take using the NAMECONFLICT attribute. For example, you can specify the parameter
NAMECONFLICT="MAKEUNIQUE"
keeping the file extension the same.

Controlling the type of file uploaded

For some applications, you might want to restrict the type of file that is uploaded. For
example, you may not want to accept graphic files in a document library.
The ACCEPT attribute is used to restrict the type of file that will be allowed in an
upload. When an ACCEPT qualifier is present, the uploaded file's MIME content type
must match the criteria specified or an error will occur. ACCEPT takes a comma-
separated list of MIME data names, optionally with wildcards.
uploadfileaction.cfm
in your browser, enter values and submit the form.
uploadfileform.cfm
NAMECONFLICT="Overwrite"
FILEFIELD="FiletoUpload">
This example performs no error checking and does not incorporate any
security measures. Before deploying an application that performs file
uploads, be sure to incorporate both error handling and security.
in the CFFILE tag to create a unique file name while
Developing Web Applications with ColdFusion
in
under the Web root directory.
myapps
Description
Prepare to upload a file to the
server.
Specify the destination of the
file.
If the file already exists,
overwrite it.
Specify the name of the file to
upload. Note that you do not
enclose the variable in pound
signs.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents