Passing Custom Attributes
You can pass custom attributes to the component by editing the file : inc_customAttributes.cfm in the root folder.
To declare a custom attribute in this file, simply CFPARAM it as follows:
<cfparam name="attributes.myDatasource" default="myDatasource">
You can now use this variable in any of the action pages of CF_MultiUploadAdvanced.
Custom Attributes are useful when you need to store information in a database after a certain action has occurred e.g: When a file is uploaded and you need to store the file name in a database.
Custom Post-Upload Processing
CF_MultiUploadAdvanced allows you to perform custom processing on the files upload after a multi-upload operation.
You can perform your custom post-upload operations by editing the file "dccom/components/multipleUploadControlX/action/act_customProcessing.cfm"
As each file is uploaded, the file details are added to a Struct() called uploadedFiles. The struct contains all the normal CFFILE ACTION="UPLOAD" variables aswell as some custom values set by CF_MultiUploadAdvanced.
The uploadedFiles struct is a struct of structs with each KEY called Filen where n is the number of the file you wish to query.
For example, to get at the file size of the third file uploaded, you could use <cfset currentFile=uploadedFiles["File3"].fileSize>
The following are a list of the keys contained in each files entry.
| Status |
The result of the upload operation : SUCCESS | FAILED |
| Message |
The message returned from the upload operation |
| attemptedServerFile |
The file attempted by the server |
| clientDirectory |
The folder on the client of the uploaded file |
| clientFile |
The file on the client in the upload operation |
| clientFileExt |
The extension of the client file in the upload operation |
| clientFileName |
The full filename of the client file in the upload operation |
| contentSubType |
The content subtype of the uploaded file |
| contentType |
The content type of the uploaded file |
| dateLastAccessed |
The date the file was last accessed |
| fileExisted |
BOOLEAN indicating whether the file existed |
| fileSize |
The file size of the uploaded file |
| fileWasAppended |
BOOLEAN indicating whether the file was appended |
| fileWasOverwritten |
BOOLEAN indicating whether the file was over written |
| fileWasRenamed |
BOOLEAN indicating whether the file was renamed |
| fileWasSaved |
BOOLEAN indicating whether the file was saved |
| oldFileSize |
The original size of the uploaded file |
| serverDirectory |
The server folder where the file was uploaded to |
| serverFile |
The name of the uploaded file on the server |
| serverFileExt |
The extension of the uploaded file on the server |
| serverFileName |
The full name of the uploaded file on the server |
| timeCreated |
The time the file was created on the server |
| timeLastModified |
The time the file was last modified on the server |
Be careful that you CFTRY/CFCATCH your code in this file.
Sample Code To Traverse Struct()
<cfset multiFileUploadReport="">
<cfset successCount=0>
<cfset failedCount=0>
<cftry>
<cfloop from="1" to="#structCount(uploadedFiles)#" index="s">
<cftry>
<cfif uploadedFiles["File" & s].status eq "Success">
<cfset successCount=successCount+1>
<cfelse>
<cfif uploadedFiles["File" & s].message neq "">
<cfset failedCount=failedCount+1>
</cfif>
</cfif>
<cfif attributes.showDebugUploadMessage eq "Yes"><cfset multiFileUploadReport=multiFileUploadReport & jsStringFormat(uploadedFiles["File" & s].message) & "\n"></cfif>
<cfif attributes.showFullUploadReport eq "yes">
<cfset session.multiUploadReport=session.multiUploadReport & uploadedFiles["File" & s].message>
</cfif>
<cfcatch></cfcatch>
</cftry>
</cfloop>
<cfset multiFileUploadReport=multiFileUploadReport & "Upload Complete : " & evaluate(successCount+failedCount) & " files processed\n\n">
<cfset multiFileUploadReport=multiFileUploadReport & " - " & successCount & " files were uploaded successfully\n">
<cfset multiFileUploadReport=multiFileUploadReport & " - " & failedCount & " files failed to upload\n">
<cfcatch>
<cfset multiFileUploadReport=cfcatch.message>
</cfcatch>
</cftry>