<cfset destination = "#ExpandPath('uploads/')#"> <cfif not directoryExists(destination)> <cfdirectory action="create" directory="#destination#"> </cfif> <cffile action="upload" filefield="uploadfile" destination="#destination#" nameConflict="makeUnique">
So here I use ExpandPath to find the directory that the current script resides and set the destination directory to store uploaded content to 'uploads'. I then check to see if the destination directory exists, if it doesn't I create it. HTH Simon On 25 Jul 2008, at 23:21, Josh Nathanson wrote: I think that the images directory has to exist already before you do the CFFILE operation, in other words it won't create the directory for you. -- Josh ----- Original Message ----- From: "Fawzi Amadu" <[EMAIL PROTECTED]> To: "CF-Talk" <cf-talk@houseoffusion.com> Sent: Friday, July 25, 2008 3:10 PM Subject: Re: CFFILE > Thanks for the info> I changed my code as follows: > > CODE: > > <cffile action="upload" > filefield="uploadProductIMAGE" > destination="C:\CFusionMX\wwwroot\e-Ghana\images\" > nameconflict="makeunique"> > > and I get the following error message: > > > > Attribute validation error for tag CFFILE. > The value of the attribute destination, which is currently > "C:\CFusionMX\wwwroot\e-Ghana\images\", is invalid. > > The error occurred in C:\CFusionMX7\wwwroot\e-Ghana > \testFileUpload.cfm: > line 17 > > 15 : filefield="uploadProductIMAGE" > 16 : destination="C:\CFusionMX\wwwroot\e-Ghana\images\" > 17 : nameconflict="makeunique"> > 18 : > 19 : <!--- make sure that file isn't more thatn 50k ---> > > > > > > > > > > > > > >> From livedocs: >> >> destination: Pathname of directory in which to upload the file. If >> not >> an absolute path (starting with a drive letter and a colon, or a >> forward >> or backward slash), it is relative to the ColdFusion temporary >> directory, which is returned by the GetTempDirectory function. >> >> >> I have up written code to upload a file for my computer, but I am >> getting an error that I do not understand. I used >> destination="../images/"with the intention of saving the file in the >> images folder of root of my site. Please help, TIA >> >> CODE: >> >> <cffile action="upload" >> filefield="uploadProductIMAGE" >> destination="../images/" >> nameconflict="makeunique"> >> >> >> ERROR MESSAGE: >> >> Attribute validation error for tag CFFILE. >> The value of the attribute destination, which is currently "../ >> images/", >> is invalid. >> >> The error occurred in C:\CFusionMX7\wwwroot\e-Ghana >> \testFileUpload.cfm: >> line 15 >> >> 13 : filefield="uploadProductIMAGE" >> 14 : destination="../images/" >> 15 : nameconflict="makeunique"> >> 16 : >> 17 : <!--- make sure that file isn't more thatn 50k ---> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309741 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4