Note The MODE attribute applies to ColdFusion on Solaris and HP-UX, only.


<CFFILE ACTION="Upload"
    FILEFIELD="formfield"
    DESTINATION="full_path_name"
    NAMECONFLICT="behavior"
    ACCEPT="mime_type/file_type"
    MODE="permission"
    ATTRIBUTES="file_attributes">

Use CFFILE with the Upload action to upload a file specified in a form field to a directory on the Web server.

FILEFIELD

Required. The name of the form field that was used to select the file.

Note: Do not use pound signs (#) to specify the field name.

DESTINATION

Required. The full path name of the destination directory on the Web server where the file should be saved. A trailing slash must be included in the target directory when uploading a file. Use the backward slash (\) on Windows ; use the forward slash (/) on UNIX.

Note: The directory does not need to be beneath the root of the Web server document directory.

NAMECONFLICT

Optional. Default is error. Determines how the file should be handled if its name conflicts with the name of a file that already exists in the directory. Valid entries are:

ACCEPT

Optional. Use to limit what types of files will be accepted. Enter one or more MIME types, each separated by comma, of the file types you want to accept. For example, to allow uploads of GIF and Microsoft Word files, enter:

Note that the browser uses the file extension to determine file type.

MODE

Optional. Defines permissions for an uploaded file on Solaris or HP-UX. Ignored in Windows. Valid entries correspond to the octal values (not symbolic) of the UNIX chmod command. Permissions are assigned for owner, group, and other, respectively. For example:

Assigns the owner read/write permissions and group/other read permission.

Assigns read/write permissions for owner, group, and other.

Assigns read, write, and execute permissions for all.

ATTRIBUTES

Optional. A comma-delimited list of file attributes to be set on the file being uploaded. The following file attributes are supported:

Note On Windows, you must include the backward slash (\) after the destination directory name. On UNIX, you must include the forward slash (/) after the destination directory. In this example, the specified destination directory is "uploads. "

Evaluating the results of a file upload

Tip Use the File prefix to refer to these parameters, for example, #File.FileExisted#.

Note File status parameters are read-only. They are set to the results of the most recent CFFILE operation. (If two CFFILE tags execute, the results of the first are overwritten by the subsequent CFFILE operation.)