Because you can't look at the file until it's uploaded. CF can't stop
the file from being uploaded. All CF can do is help you manage the
file _after_ the upload.

You can think of cffile/action=upload as:  "Crap was uploaded, give me
a handle to it so I can do crap with it."


On Tue, Jul 12, 2011 at 1:39 PM, Adam Parker <[email protected]> wrote:
>
>  What I want to accomplish is to have the user's file renamed to a designated 
> name once it passes validation. The validation works in checking that the 
> form field is not empty nor contains a file that is not designated. However, 
> using the following code, the file still gets uploaded:
>
>
> <cftry>
> <cffile
> action="UPLOAD"
> filefield="nominationLetter"
> destination="#destination#"
> nameconflict="MAKEUNIQUE"
> />
> <!--- Create variable to reference the original document name and extension 
> uploaded from client.--->
> <cfset clientNominationLetter = #file.ClientFile#>
> <!---Create variable to reference renamed document. Retain orignal file 
> extension.--->
> <cfset renameNomination = "01_nominationLetter"&"."&#cffile.clientFileExt#>
>
> <!---Rename uploaded document using variable. Save renamed document to 
> original destination.--->
> <cffile action="rename"
> source="#destination##File.ServerFile#"
> destination="#destination##Trim(renameNomination)#">
> Within the cftry blocks, I've replaced
> file="#CFFILE.ServerDirectory#\#CFFILE.ServerFile#"
> with
> file="#destination##File.ServerFile#"
>
> which is my designated file location. What am I missing?
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5362
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to