[PHP] Re: uploading files | how to avoid submitting twice?

2002-02-25 Thread George Whiffen

Jim Winstead wrote:

 Andy [EMAIL PROTECTED] wrote:
 Is there a way to redirect imediatelly to a waiting page? I tryed to
 redirect, but somehow the server is first uploading the file before
 something else happens.
 
 unfortunately, no. one thing you can do is use javascript to pop up a
 small window in your form's onsubmit method that tells the user to hang
 on, and then close that window in the next page's onload method. it
 isn't easy to do a real progress meter, but even this little bit should
 help tremendously.
 
 you may also want to check the md5 sum of the file contents against
 previous uploads to detect duplicates.
 
 jim

I've never tried it, but it may also be possible to disable the submit 
button once it has been pressed once to stop the second upload e.g.

HTML
HEAD
SCRIPT LANGUAGE=javascript
function submitonce()
{
   if (document.form.submitted.value == No)
   { 
  document.form.submitted.value == Yes;
  return true;
   } else {
  alert(Please wait...);
  return false;
   }
}
/SCRIPT
/HEAD
BODY
FORM OnSubmit=return submitonce();
INPUT TYPE=HIDDEN NAME=submitted VALUE=No
INPUT TYPE=FILE NAME=uploadfile
INPUT TYPE=SUBMIT OnClick=return submitonce();
/FORM
/BODY
/HTML   

N.B. I've set the form's OnSubmit and the submit button's onClick, only 
because I'm not sure which will work best.

I'd expect this to work with a normal form submit but maybe file upload is 
funny...

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: uploading files | how to avoid submitting twice?

2002-02-23 Thread Jim Winstead

Andy [EMAIL PROTECTED] wrote:
 Is there a way to redirect imediatelly to a waiting page? I tryed to
 redirect, but somehow the server is first uploading the file before
 something else happens.

unfortunately, no. one thing you can do is use javascript to pop up a
small window in your form's onsubmit method that tells the user to hang
on, and then close that window in the next page's onload method. it
isn't easy to do a real progress meter, but even this little bit should
help tremendously.

you may also want to check the md5 sum of the file contents against
previous uploads to detect duplicates.

jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php