Does anyone know how to get a progress bar for an upload in php? I am trying writing code for a photo album uploader. I would like a progress bar to display while the photos
One PHP-ish (5.2+) & no-Flash way that worked nicely for me:
First, see this post explaining how to get "uploadprogress" extension up and running.
Then, in the page containing the form that you are uploading file(s) from, create the following iframe:
Next, add this code to your "Submit" button:
onclick="function set() { f=document.getElementById('progress_iframe'); f.style.display='block'; f.src='uploadprogress.php?id==$upload_id?>';} setTimeout(set);"
Now you have a hidden iframe in your form that will come visible and show contents of uploadprogress.php when you click "Submit" to start uploading files. $upload_id must be the same that you are using as the value of hidden field "UPLOAD_IDENTIFIER" in your form.
The uploadprogress.php itself looks about like this (fix and adjust to your needs):
'>
Upload progress:
Note that is self-refreshes every second. You can surely add some nice visual progress bar here (like 2 nested