>- see footer for list info -< Cause if you don't you can get a race condition and CF could crash. This was more so on pre-MX CF. Basically if you don't lock them then they could be altered by another process before you re-set them which would not be ideal.
N -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Damian Watson Sent: 20 October 2004 10:39 To: Matt Horn; Coldfusion Development Subject: Re: [CF-Dev] cffile - pic uploads >- see footer for list info -< Matt, *not flaming, just curious* can you explain exactly why this is a prudent thing to do? Matt Horn wrote: >>- see footer for list info -< >> >> >Cflock ... > > at the risk of starting a flame war > >when accessing session variables it is prudent to lock them and drop the >scope to request > > like such > ><cflock scope="session" timeout="10"> > <cfset request.foo = session.foo> ></cflock> > >and then use request.foo in any code you want to use the session variable >in. > >HTH > > >----- Original Message ----- >From: "Jenny" <[EMAIL PROTECTED]> >To: "Coldfusion Development" <[EMAIL PROTECTED]> >Sent: Monday, October 18, 2004 1:53 PM >Subject: RE: [CF-Dev] cffile - pic uploads > > > > >>>- see footer for list info -< >>> >>> >>Hi Matt and Duncan, >> >>Thanks both for your help. >> >>Sorted the problem. Instead of trying to maintain anything like the >>filename uploaded I've just renemaed it to the users ID. >> >>I'm unclear on cflock .... ? >> >>Jenny >>http://www.chicksnchaps.co.uk >> >> >><!-- check file name has been entered --> >><cfif NOT Len(form.file)> >> <cflocation url="change_add_pic.cfm"> >></cfif> >> >><!-- get user details --> >><cfquery name="Register" datasource="dating"> >>SELECT * >>FROM dbo.Registered >>WHERE dbo.Registered.RegisterID = #session.registerID# >></cfquery> >> >><!-- get the new photo --> >><cfoutput> >><cffile accept="image/jpeg, image/jpg, image/pjpeg, image/gif" >>action="upload" attributes="normal" >>destination="C:\Apache2\htdocs\profiles\photos\" filefield="form.file" >>nameconflict="makeunique"> >></cfoutput> >> >><cffile action="rename" >> >> >> >destination="#cffile.ServerDirectory#\#register.registerid#.#serverfileext# " > > >source="#cffile.ServerDirectory#\#cffile.serverfileName#.#cffile.serverfile E > > >>xt#"></cffile> >> >><cfset filename = "#register.registerid#.#serverfileext#"> >><cfset thumbname = "thumb_#register.registerid#.#serverfileext#"> >> >> >> <cfquery datasource="dating"> >>UPDATE Registered >>SET Photo = '#filename#', PhotoThumb ='#thumbname#' >>WHERE Registered.RegisterID = #session.registerID# >> </cfquery> >> >><!-- create new thumbs --> >><cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe" >>arguments = "-sample 200x200 \apache2\htdocs\profiles\photos\#filename# >>\apache2\htdocs\profiles\photos\thumbs\#thumbname#"></cfexecute> >><cfexecute name = "c:\Program Files\ImageMagick-6.0.1-Q16\convert.exe" >>arguments = "-sample 125x125 \apache2\htdocs\profiles\photos\#filename# >>\apache2\htdocs\profiles\photos\thumbs\small\#thumbname#"></cfexecute> >> >><!-- set profile for admin review and return to View Profile --> >><cflocation url="profile_updated.cfm"> >> >> >>_______________________________________________ >> >>For details on ALL mailing lists and for joining or leaving lists, go to >> >> >http://list.cfdeveloper.co.uk/mailman/listinfo > > >>-- >>CFDeveloper Sponsors:- >> >> >>>- Hosting provided by www.cfmxhosting.co.uk -< >>>- Forum provided by www.fusetalk.com -< >>>- DHTML Menus provided by www.APYCOM.com -< >>>- Lists hosted by www.Gradwell.com -< >>>- CFdeveloper is run by Russ Michaels, feel free to volunteer your >>> >>> >help -< > > > > >_______________________________________________ > >For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo > >-- >CFDeveloper Sponsors:- > > >>- Hosting provided by www.cfmxhosting.co.uk -< >>- Forum provided by www.fusetalk.com -< >>- DHTML Menus provided by www.APYCOM.com -< >>- Lists hosted by www.Gradwell.com -< >>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -< >> >> > > > _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -< This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant, Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions. Visit our website at http://www.reedexpo.com _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
