User Guide

Table Of Contents
Using cffile 1007
Note: Current versions of Microsoft Internet Explorer and Netscape support MIME type associations.
Other browsers and earlier versions might ignore these associations.
ColdFusion saves any uploaded file if you omit the accept attribute or specify "*/*". You can
restrict the file types, as demonstrated in the following examples.
The following
cffile tag saves an image file only if it is in the GIF format:
<cffile action="Upload"
fileField="Form.FiletoUpload"
destination="c:\uploads\"
nameConflict="Overwrite"
accept="image/gif">
The following cffile tag saves an image file only if it is in GIF or JPEG format:
<cffile action="Upload"
fileField="Form.FiletoUpload"
destination="c:\uploads\"
nameConflict="Overwrite"
accept="image/gif, image/jpeg">
Note: If you receive an error similar to "The MIME type of the uploaded file (image/jpeg) was not
accepted by the server", enter
accept="image/jpeg" to accept JPEG files.
This cffile tag saves any image file, regardless of the format:
<cffile action="Upload"
fileField="Form.FiletoUpload"
destination="c:\uploads\"
nameConflict="Overwrite"
accept="image/*">
Setting file and directory attributes
In Windows, you specify file attributes using the
cffile attributes attribute. In UNIX, you
specify file or directory permissions using the
mode attribute of the cffile or cfdirectory tag.
Windows
In Windows, you can set the following file attributes:
Hidden
Normal
ReadOnly
To specify several attributes in CFML, use a comma-separated list for the
attributes attribute;
for example,
attributes="ReadOnly,Hidden". If you do not use the attributes attribute, the
files existing attributes are maintained. If you specify any other attributes in addition to Normal,
the additional attribute overrides the Normal setting.