Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

on error, wait 20 seconds and retry file upload 1

Status
Not open for further replies.

Streetdaddy

Programmer
Jun 10, 1999
161
AU
When uploading a file, I am checking for an error. If the error occurs, I want to wait 20 seconds, then retry the upload.

Is there a tag or function that will wait 20 seconds, then continue processing? I can't find one... Miles Tillinger
SE Net Web Design
vmiles@senet.com.au
 
setInterval(javascript_action,delay)

where javascript_action is something like "document.location.replace("any_url")"
and delay is usually 1000 or something, i don't know if those are ms or what

 
I believe the delay interval is in milliseconds, making 20 seconds a value of 20,000, but I don't think javascript is the right way to do this, since ColdFusion, on the server is what's going to have to detemine whether or not there's been an error...

 
The CF server throws an error when the CFFILE delete fails on a file that is process locked. I need to wait 20 seconds, then retry the file delete Miles Tillinger
SE Net Web Design
vmiles@senet.com.au
 
AHA!!!!!

I think I've got it!!!! Try something like...
Code:
<CFTRY>

  <CFFILE ACTION=&quot;UPLOAD&quot; FILEFIELD=&quot;Form.TheFile&quot; DESTINATION=&quot;/uploads&quot; NAMECONFLICT=&quot;MAKEUNIQUE&quot;>

<CFCATCH>
  <HTML>
  <HEAD>
    <META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;20&quot;>
    <TITLE>Upload Error- Waiting 20 seconds</TITLE>
  </HEAD>
  <BODY>
    <H1>Upload Error, waiting 20 seconds to Retry</H1>
  </BODY>
  </HTML>
</CFCATCH>
</CFTRY>

<HTML>
<HEAD>
  <TITLE>File Uploaded</TITLE>
</HEAD>
<BODY>
  <H1>File Uploaded Successfully</H1>
</BODY>
</HTML>
Let me know if this works.... DarkMan
 
Well, it definitely would work! And I think its better than the way I worked it out.

I found a custom tag CFX_SLEEP which is perfect. But your way would also be good because it would tell the user what is happening, whereas using the custom tag means that nothing is output until the file succesfully uploads... Miles Tillinger
SE Net Web Design
vmiles@senet.com.au
 
yes DM ! this is the way : letting the user sleep and then reload instead of letting it to the processor :)
i love that solution !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top