Chapter 14: Managing Files on the Server
A file's MIME type is determined by the browser. Common types, like "image/gif" and
"text/plain", are registered in your browser.
Note
Example: Restricting file types
This CFFILE specification will only save an image file that is in the GIF format:
<CFFILE ACTION="Upload"
FILEFIELD="UploadFile"
DESTINATION="c:\uploads\MyImage.GIF"
NAMECONFLICT="OVERWRITE"
ACCEPT="image/gif">
This CFFILE specification will only save an image file that is either a GIF or a JPEG:
<CFFILE ACTION="Upload"
FILEFIELD="UploadFile"
DESTINATION="c:\uploads\MyImage.GIF"
NAMECONFLICT="OVERWRITE"
ACCEPT="image/gif, image/jpeg">
This CFFILE specification will only save an image file, but the format doesn't matter:
<CFFILE ACTION="Upload"
FILEFIELD="UploadFile"
DESTINATION="c:\uploads\MyImage.GIF"
NAMECONFLICT="OVERWRITE"
ACCEPT="image/*">
Note
Setting File and Directory Attributes
File attributes in Windows are defined using the CFFILE ATTRIBUTES attribute. In
UNIX, file and directory permissions are defined using the CFFILE and CFDIRECTORY
MODE attribute.
UNIX
In UNIX, you can set permissions on files and directories for owner, group, and other.
Values for the MODE attribute correspond to octal values for the UNIX chmod
command:
4 = Read only
2 = Read/write
1 = Read/write/execute
Not all browsers support MIME type associations.
Any file will be saved if ACCEPT is omitted, left empty, or contains "*/*".
223