I seem to be getting closer... I know my filepath variable is
correctly getting set, but I can't seem to get it over to the
formtools "file.cfc" for the uploading/renaming...

Can someone advise as to how to get the path I want the file.cfc to
use passed over? Do I need to do this before.. BeforeSave?

<cffunction name="BeforeSave" access="public" output="true"
returntype="struct">
        <cfargument name="stProperties" required="true" type="struct">
        <cfargument name="stFields" required="true" type="struct">
        <cfargument name="stFormPost" required="false" type="struct">

        <!---
                This will set the default Label value. It first looks form the
bLabel associated metadata.
                Otherwise it will look for title, then name and then anything 
with
the substring Name.
         --->
        <cfset var NewLabel = "" />
        <cfset var filepath = "" />
        <cfset var fileContents = "" />

        <cfparam name="arguments.stProperties.label" default="">

        <cfif structKeyExists(arguments.stProperties,"Title")>
                <cfset arguments.stProperties.label =
"#arguments.stProperties.title#">
        </cfif>

        <cfset arguments.stProperties.datetimelastupdated = now() />

        <cfif structKeyExists(arguments.stProperties,"filename") AND
len(trim(arguments.stProperties.filename))>


                <cfif
structKeyExists(arguments.stFields.filename.Metadata,"ftSecure") AND
arguments.stFields.filename.Metadata.ftSecure>
                        <cfset filepath = application.path.secureFilePath />
                <cfelse>
                        <cfset filepath = application.path.defaultFilePath />
                </cfif>

<!--- EXTENDED: determine the division & pub type folders via category
--->

<cfparam name="arguments.stProperties.pubdivision" default="">
<cfparam name="arguments.stProperties.pubtype" default="">

        <cfif structKeyExists(arguments.stProperties,"pubdivision") AND
len(trim(arguments.stProperties.pubdivision))>

                        <cfquery name="qDivAlias" 
datasource="#application.dsn#">
                        SELECT categoryid,alias
                        FROM #application.dbowner#categories
                        WHERE categoryid = 
'#arguments.stProperties.pubdivision#'
                        </cfquery>

                          <cfif qDivAlias.recordcount EQ 1>
                                <cfset divFolder = "/" & Trim(qDivAlias.alias)>
                            <cfset filepath = filepath & divFolder>
                          </cfif>
        </cfif>

        <cfif structKeyExists(arguments.stProperties,"pubtype") AND
len(trim(arguments.stProperties.pubtype))>
                        <cfquery name="qPubAlias" 
datasource="#application.dsn#">
                        SELECT categoryid,alias
                        FROM #application.dbowner#categories
                        WHERE categoryid = '#arguments.stProperties.pubtype#'
                        </cfquery>
          <cfif qPubAlias.recordcount EQ 1>
             <cfset PubFolder = "/" & Trim(qPubAlias.alias)>
          <cfelse>
             <cfset PubFolder = "misc">
          </cfif>
                 <cfset filepath = filepath & pubfolder>
        </cfif>
        <cflog log="application" type="information" text="
        pub div:#arguments.stProperties.pubdivision# (q:#divFolder#)
        pub type:#arguments.stProperties.pubtype# (q:#PubFolder#)
        ftdest: #arguments.stFields.filename.Metadata.ftDestination#
        filepath: #filepath#
        ">
<!--- END EXTENDED --->


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/farcry-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to