<CFFILE ACTION="Upload"
FILEFIELD="formfield"
DESTINATION="directory"
NAMECONFLICT="behavior"
ACCEPT="file_extension"
MODE="permission"
ATTRIBUTES="file_attributes">
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 destination directory on the Web server where the file should be saved.
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:
- Error -- Default. The file will not be saved, and ColdFusion will stop processing the page and return an error.
- Skip -- Neither saves the file nor throws an error. This setting is intended to allow custom behavior based on inspection of FILE properties.
- Overwrite -- Replaces an existing file if it shares the same name as the CFFILE destination.
- MakeUnique -- Automatically generates a unique filename for the upload. This name will be stored in the FILE object variable "ServerFile." You can use this variable to record what name was used when the file was saved.
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:
ACCEPT="image/gif, application/msword"
Note: The browser uses the file extension to determine file type.
MODE
Optional. Defines permissions for an uploaded file in Solaris. 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:
MODE=644
Assigns the owner read/write permissions and group/other read permission.
MODE=666
Assigns read/write permissions for owner, group, and other.
MODE=777
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:
- ReadOnly
- Temporary
- Archive
- Hidden
- System
- Normal
If ATTRIBUTES is not used, the file's attributes are maintained. If Normal is specified as well as any other attributes, Normal is overridden by whatever other attribute is specified.
Individual attributes must be specified explicitly. For example, if you specify just the ReadOnly attribute, all other existing attributes are overwritten.
|