Hrm.. it seems I forgot about the attachment filter. Here's the altered
source code for picker.cfm in [Spectra Install Dir]\program
files\allaire\spectra\handlers\system\file\ .
 
** Start Code
 
<!--- copyright 1999-2001 Allaire Corp., All Rights Reserved --->
<cfa_serverSettingsGet>
<cfsetting enablecfoutputonly="yes">
<!--- 
 
 COAPI Object Handler (content object create initialization method)
 
 Object:    file
 
 Method:    picker
 
 Template:   picker.cfm
 
 Author:    Allen Manning
 
 Source Control:  $Header: /defender/handlers/system/file/picker.cfm 15
10/21/99 2:20p Amanning $
 
 Description:  point this handler at a directory and it will allow you to
browse for files,
      once the file has been picked and submitted it will update the current
object 
      with the picked information.
 
 Custom Attributes: stParams.directoryPath (required) -the directory to
contain uploaded files.
      stParams.directoryURL (required) -the URL (excluding file name) of the
directory 
       that will allow you to access file from web server.
      stParams.defaultFile (optional) - default file to select in list
      
 
 Return Paramters: none (update self)
--->
 
<cfinclude template="_settings.cfm">
 
<cfa_handler object="stFilePicker">
 <cfa_controlHandler name="filepicker" r_contextName="cn"
r_stContextData="cd">
  
  <cfparam name="cd.filename" default="#stFilePicker.fileName#">
  
  <!--- validate directory path--->
  <cfparam name="attributes.stParams.directoryPath">
  <cfif ((not directoryExists(attributes.stParams.directoryPath)) or
(right(attributes.stParams.directoryPath,1) neq "/") and
right(attributes.stParams.directoryPath,1) neq "\")>  
   <cfscript>
    stDetail = structNew();
    stDetail.directoryPath = attributes.stParams.directoryPath;
    stDetail.currentTemplate = getCurrentTemplatePath();
   </cfscript>
   
   <!--- throw exception ---> 
   <cfa_throw
    stErrorData="#stDetail#"
    errorcode="dirdoesnotexist"> 
   
   <cfexit method="exittag">
  </cfif>
  
  <cfparam name="attributes.stParams.directoryURL" default="">
  <cfa_controlHandlerEvent name="bfileselected">
   <cfparam name="form.fileName" default="">
   <cfscript>
    stProperties = structNew();
    filePath = attributes.stParams.directoryPath & form.fileName;
   </cfscript>
   
   <cfa_contentObjectData datasource="#dataSource#"
objectid="#stFilePicker.objectID#">
    <cfa_contentObjectProperty name="filePath"
value="#stFilePicker.filePath#">
    <cfa_contentObjectProperty name="fileName" value="#evaluate(cn &
'.filename')#">
    <cfif len(attributes.stParams.directoryURL)>
     <cfa_contentObjectProperty name="fileURL"
value="#attributes.stParams.directoryURL##cd.filename#">
    <cfelse>
     <cfa_contentObjectProperty name="fileURL"
value="#filepath##cd.filename#">
    </cfif>
   </cfa_contentObjectData>
   
   <!--- actually get the object to update the display --->
   <cfset stFilePicker.filename = stFilePicker.filename>
   
   <!--- tfl 3/11/99: default file support (see below) --->
   <cfset attributes.stParams.defaultFile = form.fileName>
  </cfa_controlHandlerEvent>
  
 
  
  <!--- check directory --->
  <cfdirectory 
   action="LIST" 
   directory="#attributes.stParams.directoryPath#" 
   name="listFiles">
 
  <!--- render picker --->
  <!--- tfl 3/11/99: optional filtering of file extension list; default file
support --->
  <cfparam name="attributes.stParams.lExtensionFilter" default="">
  <cfparam name="attributes.stParams.defaultFile" default="">
  <!--- [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  3/26/01: added param
for bIncludeFile to fix stParams.lExtensionFilter attribute --->
  <cfparam name="bIncludeFile" default="true">
  
  <cfoutput> 
   <select name="#cn#.filename" style="width:202;">
  </cfoutput> 
   <cfoutput query="listFiles">
    <cfif attributes.stParams.lExtensionFilter is not "">
     <cfa_getFileExtension file="#name#" r_extension="extension">
     <cfif not listFindNoCase(attributes.stParams.lExtensionFilter,
extension)>
      <cfset bIncludeFile = "false">
     </cfif>
    </cfif>
    <!--- [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  3/26/01: added blank
option for first option if stParams lExtensionFilter is passed and this is
the first row in the query --->
    <cfif attributes.stParams.lExtensionFilter is not "" AND
listFiles.CurrentRow EQ 1>
     <option value="">
    </CFIF>
    <!--- [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  3/26/01: added
bIncludeFile conditional and resetting of bIncludeFile to true --->
    <cfif bIncludeFile>
     <option value="#left(name,50)#" <cfif name eq
stFilePicker.filename>selected</cfif>>&nbsp;#left(name,20)#
    </cfif>
    <cfset bIncludeFile = "true">
   </cfoutput>
  <cfoutput>
   </select>
   <input type="hidden" name="#cn#.bfileselected" value="#objectID#">
  </cfoutput>
  
 </cfa_controlHandler>
</cfa_handler>
 
<cfsetting enablecfoutputonly="no">
 
 
** End code

-
Nate Smith, 
Lead Developer 
[EMAIL PROTECTED] 
www.doceus.com 

 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to