<cffile action="upload"> DOES NOT rename files. it just moves the uploaded file from the temp upload dir on the server to the dir on the server you specify in the DESTINATION attribute. depending on the value of NAMECONFLICT attribute, this action will either overwrite a file with the same name if it already exists in the destination folder, or will append a sequential number to the file name. to rename a file you should use <cffile action="rename">.
Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/ Fawzi Amadu wrote: > I have re-written the code and it is working, except that the renaming of the > files (filefield="#variables.filename#") part is not working. When I dump > (see code below) the session variable that I am assigning to filefield, I get > the correct result, but the filename is not changed on upload when I check > them at where there are stored. > > > <!--- Assign the productID to a session variable ---> > > <cflock timeout=20 scope="Session" type="Exclusive"> > <cfset Session.ExtraProductImgName = URL.Cnsmr_ProductID> > </cflock> > > <!--testing for the value of session variable --> > <cfdump var="#Session.ExtraProductImgName#"> > > > <!---create variable to hold destination of uploaded files---> > <cfset upLoadDestination = "#ExpandPath('images/consumer/')#"> > <cfif isdefined("form.upload")> > <cfloop index="i" from="1" to="#Session.numberoffields#" step="1"> > <cfset filename = "#Session.ExtraProductImgName#" & #i#> > <!--- cfif evaluate(variables.filename) neq "" ---> > <cffile action="UPLOAD" destination="#upLoadDestination#" > nameconflict="makeunique" filefield="#variables.filename#"> > <!---/cfif---> > </cfloop> > > <!--- Delete the session variable after uploading files related to > this particular ProductID ---> > > <cflock timeout=20 scope="Session" type="Exclusive"> > <cfset StructDelete(Session, "ExtraProductImgName")> > </cflock> > > > </cfif> > </cfif> <!--- end extra upload processing ---> > > >> Fawzi, >> Are you saying that you removed the nested cf-tags and the problem persists? >> If that is what you are saying, please post your new code as edited, so we >> can see what else might be wrong. >> >> William >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:321210 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

