- 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.serverfileE


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 -<

Reply via email to