Table Of Contents
 

CF_FileManager Custom Actions & Parameters

Author : Daniel Mackey Email : dan@digital-crew.com

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_FileManager.

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_FileManager 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/dcFileManager3/action/act_customAfterUploadProcessing.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_FileManager.

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.

Please view Page 2 for example code for traversing the struct.

Custom Double Click Actions

You can tell CF_FileManager to perform a certain operation on certain files when the file is double clicked.

For example, you could set all files to download when double clicked on, edit text files when double clicked on or even view images when double clicked on.

To use the custom double-click actions, a number of parameters must be passed to CF_FileManager.

<cfparam name="attributes.dblClick_extensions" default="">
<cfparam name="attributes.dblClick_actions" default="">
<cfparam name="attributes.dblClick_targets" default="">

dblClick_extensions

This parameter takes a comma-delimited list of extensions that tell CF_FileManager to perform some action (described in dblClick_actions) on files with that extension.

An example of this attribute would be dblClick_extensions="txt,ini,jpg"

You can also use the value ALL to perform the double-click action on all files, regardless of the extension.

dblClick_actions

This parameter takes a comma-delimited list of actions telling the component what ColdFusion file is to be called for the specified extension at the same list index as described in dblClick_extensions.

The ColdFusion file specified should be placed in the "dccom/components/dcFileManagerV3/action/customActions/" folder.

An example of this attribute would be dblClick_actions="cust_dblClickEditText.cfm,cust_dblClickEditText.cfm,cust_dblClickViewImage.cfm"

dblClick_targets

This parameter takes a comma-delimited list of targets (popup or iframe) telling the component in what manner to perform the action for the specified exetension at the same list index as described in dblClick_actions

Valid entries are:

  • IFRAME - Performs the action in a hidden fashion using the hidden worker iframe. This is useful for deleting or downloading files.
  • POPUP  - Performs the action in a visible pop-up window. This is useful for editing or viewing files.

Example Double Click Code

Example 1:

The following tells CF_FileManager to download every file that is double clicked on.

<CF_DCCOM component="dcFileManagerv3"
  folder="c:\my folder\" 
  dblclick_extensions="all"
  dblclick_actions="cust_dblClickDownload.cfm"
  dblclick_targets="iframe"
 ></CF_DCCOM>

Example 2:

The following tells CF_FileManager to download every .jpg and .gif file and edit every .txt and .ini file that is double clicked on.

<CF_DCCOM component="dcFileManagerv3"
  folder="c:\my folder\" 
  dblclick_extensions="txt,ini,jpg,gif"
  dblclick_actions="cust_editTextFile.cfm,cust_editTextFile.cfm,cust_dblClickDownload.cfm,cust_dblClickDownload.cfm"
  dblclick_targets="popup,popup,iframe,iframe"
 ></CF_DCCOM>