We have a service whereby users upload images to our website. We've designed a 
flash player 8 upload system that uses cffile operations. 

However, if more than one user is uploading images at the same time, coldfusion 
can hang and the coldfusion service has to be restarted. We are NOT currently 
using cflock as we didn't want to slow down the system under load but feel that 
this may be reason that:
1. We are occasionally losing the temp directory
2. ColdFusion hangs.  

Here's a summary of the cffile code that we use...

<!--- this code is a hack. Occasionally the temp folder would completely 
disappear and in its place there would appear a temp file. This code checks for 
the existance of the temp folder, if not there, then it would delete the temp 
file that's there in its place, and then it creates the temp folder --->
<cfset TempStorage = ExpandPath("../../UserImages/Temp")>


<cfif DirectoryExists(tempStorage)>

<cfelse>
        <!--- See if the temp file exists, if so, delete it so that the temp 
folder can be made --->
        <cfif fileexists(Expandpath("../../UserImages/Temp"))>
          <cfset deletefile =ExpandPath("../../UserImages/Temp")>
        <cffile action="delete" file="#deletefile#">
    </cfif>
        <cfset xDirectory = ExpandPath("../../UserImages/Temp")>
        <CFDIRECTORY ACTION="create" directory="#xDirectory#">
</cfif>

<!--- Next, we upload the image saving it with a unique filename --->
<cffile action="UPLOAD" filefield="Filedata" 
destination="#variables.TempStorage#" nameconflict="MakeUnique">

<!--- Then we move this file to the user's directory --->
<cffile action="move" source="#variables.OldFilePath#" 
destination="#variables.NewFilePath#">

Any advice as to why and where we should use cflock would be greatly 
appreciated. Many thanks!


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296879
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to