Whatever message this page gives is out now! Go check it out!
Parameter | Required | Default | Description |
destination | Required | 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 | Optional | Limits the MIME types to accept. It is a comma-delimited list. For example, the following code permits JPEG and Microsoft Word file uploads:"image/jpg,application/msword". When strict="true" If the mime type is specified in the accept attribute, the file does not get uploaded if the extension is blocked in the server or application settings. When strict="false" If you provide a file extension in the attribute accept, the extension overrides the blocked extension list in the server or application settings. The file then gets uploaded. If the file that you are trying to upload has it’s extension blocked in the Administrator/Application-level settings, and the mime type is specified in the accept attribute, the file does not get uploaded. For example,
Values specified in the attribute allowedExtensions overrides the list of blocked extensions in the server or application settings. | |
nameConflict | Optional | Error | Action to take if file has the same name of a file in the directory.
|
continueOnError | Optional | False | By default, when uploading one of the files fail, the remaining files will not be uploaded. If this value is set to true, file upload continues evern after encountering an upload error. A file upload error happens due to the following reasons: 1. Empty file 2. Invalid file type 3. Invalid MIME or extension 4. File already exists In the case of an upload failure, the error details will be stored in the errors attribute. |
allowedExtensions | Optional | A comma-separated list of file extensions, which will be allowed for upload. For example, .png, .jpg, or, .jpeg. You can use "*" (star) to allow all files, except where you specify the MIME type in the accept attribute. Values specified in the attribute allowedExtensions override the list of blocked extensions in the server or application settings. | |
strict | Optional | True | strict="false" If you provide a file extension in the attribute accept, the extension overrides the blocked extension list in the server or application settings. The file then gets uploaded. If you provide a MIME type in the attribute accept, and the extension of the file you are trying to upload is blocked in the Administrator/Application-level settings, the file does not get uploaded. For example,
strict="true" If the mime type is specified in the accept attribute, the file does not get uploaded if the extension is blocked in the server or application settings. For example, if you have blocked file type CFM in the ColdFusion Administrator and specified accept=”text/x-coldfusion” and strict=”true” ,and you try uploading a cfm file, the file does not get uploaded. Values specified in the attribute allowedExtensions overrides the list of blocked extensions in the server or application settings. |
errors | Optional | cffile .uploadAllErrors | The name of the variable in which the file upload errors will be stored. Errors will be populated in the specified variable name when continueOnError is true .After the file upload is completed, this tag creates an array of structures that contains upload failure information for each upload failure. The upload failure information error structure contains the following fields:
|
<cfscript>
destination=GetDirectoryFromPath(GetCurrentTemplatePath());
acceptMimes="image/png, image/jpeg, text/x-coldfusion, text/plain, application/xml";
onConflict="MakeUnique";
strict = false;
continueOnErr = false;
errOnOps = "";
acceptExtensions = ".png, .cfm";
fileUploaded = FileUploadAll(destination, acceptMimes, onConflict, strict, continueOnErr, errOnOps, acceptExtensions);
writeDump(fileUploaded);
</cfscript>