Used to work with files on the server on which ColdFusion is installed. The action performed depends on the action attribute. For this tag to work, it must be enabled in the ColdFusion Administrator.
action (Required)
The type of action that the tag performs, including upload, move, rename, copy, read, delete, readBinary, write, and append.
fileField (Required)
Name of form field used to select the file. Do not use pound signs to specify the field name.
destination (Required)
The absolute path name of a directory or file on the web server.
nameConflict (Optional)
Default: error
Action to take if filename is the same as that of a file in the directory.
error. File is not saved. ColdFusion stops processing the page and returns an error.
skip. File is not saved. This option permits custom behavior based on file properties.
overwrite. Replaces file.
makeUnique. Forms a unique filename for the upload.
accept (Optional)
You can limit the types of files that can be uploaded with this attribute. If you want to allow multiple file types, they should put into a comma-delimited list.
mode (Optional)
Applies only to Solaris and HP-UX. Enacts permissions and allows use of the chmod command. For example:
attributes (Optional)
This enables you to set file attributes on a file. You can only set one attribute for Windows files. You can set a list of attributes for other platforms. Options include readOnly, hidden, and normal.
source (Required)
Absolute path name of a file on the web server.
charset (Optional)
Default: ISO-8859-1, which is the Java character set name used for the file contents.
file (Required)
Absolute path name of a file.
variable (Required)
Name of variable to contain contents of text file.
encoding (Optional)
Default: (ISO-8859)-1, which is the character encoding of generated output. Any valid character encoding is usable.
output (Required)
Content of the file to be created.
addNewLine (Optional)
Default: Yes, which appends newline character to text. After a file upload is completed, you can get status information using the file upload parameters listed next. The status parameters use the cffile prefix; for example, cffile.clientDirectory. Status parameters can be used anywhere other ColdFusion parameters can be used. The upload parameters include the following:
attemptedServerFile
Initial name ColdFusion used when attempting to save a file.
clientDirectory
Directory location of the file uploaded from the client's system.
clientFile
Name of the file uploaded from the client's system.
clientFileExt
Extension of the uploaded file on the client system.
clientFileName
Name of the uploaded file on the client system.
contentSubType
MIME content subtype of the saved file.
contentType
MIME content type of the saved file.
dateLastAccessed
Date and time the uploaded file was last accessed.
fileExisted
Whether the file already existed with the same path.
fileSize
Size of the uploaded file.
fileWasAppended
Whether ColdFusion appended an uploaded file to a file.
fileWasOverwritten
Whether ColdFusion overwrote a file.
fileWasRenamed
Whether the uploaded file was renamed to avoid a name conflict.
fileWasSaved
Whether ColdFusion saved a file.
oldFileSize
Size of the file that was overwritten during the file upload operation.
serverDirectory
Directory of the file saved on the server.
serverFile
Filename of the file saved on the server.
serverFileExt
Extension of the uploaded file on the server.
serverFileName
Name of the uploaded file on the server.
timeCreated
Time the uploaded file was created.
timeLastModified
Date and time of the last modification to the uploaded file.