Question
Does CFthread works when you close the browser window?
Hi,
I am using CFthread to upload a file to ftp sever, The requirement is to upload the file in background even after the browser window is closed after user start uploading the file. Is is possible with CFthread?
Code that i am using:
<cfif (IsDefined("form.FileContents") && form.FileContents NEQ "")>
<cfthread action="run" name="fileUploadThread">
<cfset FileInfo=GetFileInfo("#form.FileContents#")>
<cfset fileSizeToUpload = FileInfo.size>
<cfset expectedCheckSum= form.actualCheckSum>
<cfset variables.uploadedFileServerName = "TestUploadFile" & "/" & "#fileName#" />
<!---<cfset fileName = uploadResult.serverfile/>--->
<cfftp connection="session.ftpConn"
action="open"
server="someserverName"
username="someuser"
password="somepassword"
stoponerror="Yes"
timeout="90000">
Did it open connection? <cfoutput>#cfftp.succeeded#</cfoutput><br />
<cfif cfftp.succeeded>
<cfftp connection = "session.ftpConn"
action = "PutFile"
localFile="#form.FileContents#"
remoteFile="#variables.uploadedFileServerName#"
stoponerror="Yes"
passive = "Yes"
timeout="90000">
<P>Did it succeed? <CFOUTPUT>#CFFTP.Succeeded#</CFOUTPUT>
</cfif>
</cfthread>
</cfif>
Thanks in advance.
