Description
Uploads file to a directory on the server.
Returns
Struct that contains the result (or status) of file upload.For details of what the struct contains, see the usage section of cffile action = "upload".
Function syntax
FileUpload(destination)
FileUpload(destination, filefield)
FileUpload(destination, filefield, accept)
FileUpload(destination, filefield, accept, nameconflict)
History
ColdFusion 9.0.1: Added this function.
Parameters
Value |
Description |
---|---|
destination |
Path of directory in which to upload the file. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory returned by the function getTempDirectory. If the destination you specify does not exist, ColdFusion creates a file with the specified destination name. For example, if you specify the destination C:\XYZ, ColdFusion creates a file XYZ in the C: drive. |
accept |
Limits the MIME types to accept. Comma-delimited list. For example, the following code permits JPEG and Microsoft Word file uploads:"image/jpg,application/msword".The browser uses the filename extension to determine file type. |
nameConflict |
Action to take if file has the same name of a file in the directory.
|
fileField |
Name of form field used to select the file. Do not use number signs (#) to specify the field name. |
See also
Usage
Example
<cfif isdefined("form.fileData")>
|