Just use the form variable directly (although this could be dangerous from a
security perspective as the formfield could be maliciously modified). Thus:

<CFFILE ACTION= "UPLOAD"
        FILEFIELD = "UploadFile"
        DESTINATION = "D:\#Form.DocType#\"
        NAMECONFLICT = "MakeUnique">

Alternatively, for the more security conscious:
<cfswitch expression="#Form.DocType#">
        <cfcase value="WINS">
                <cfset destination="d:\wins\">
        </cfcase>
        <cfcase value="PROC">
                <cfset destination="d:\proc\">
        </cfcase>
        <cfdefaultcase>
                <cfset destination="">
        </cfdefaultcase>
</cfswitch>
<cfif Len(variables.destination)>
        <CFFILE ACTION= "UPLOAD"
                FILEFIELD = "UploadFile"
                DESTINATION = "D:\#variables.destination#\"
                NAMECONFLICT = "MakeUnique">
<cfelse>
        INVALID DESTINATION ATTRIBUTE
        <cfabort>
</cfif>

> -----Original Message-----
> From: Smith, Melanie [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 19, 2000 14:54
> To: '[EMAIL PROTECTED]'
> Subject: CFFILE and passing destination variable
>
>
> Hi all - I'm trying to store files to different directories based on a
> variable I have the user enter in from a select box. For example, if the
> user selects "WINS" I want the file to go to d:\WINS, if they
> select "PROC"
> I want the file to go to d:\PROC. Having lotsa problems with CFIF. Here's
> the code on the action page:
>
> <CFFILE ACTION= "UPLOAD"
> FILEFIELD = "UploadFile"
> <CFIF '#Form.DocType#' = 'WINS'>
> DESTINATION = "D:\Wins\"
> </CFIF>
> NAMECONFLICT = "MakeUnique">
>
> I'm getting the following syntax error:
>
> Just in time compilation error
>
> Invalid token found on line 4 at position 4. ColdFusion was looking at the
> following text:
>
> <
> Invalid expression element. The usual cause of this error is a misspelling
> in the expression text.
>
> I know this is probably something easy and I'm just being dumb but I am a
> newbie after all. Thanks to all for your help!
>
>
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to