0

Possible Duplicate:
How to show ajax loading gif animation while the page is loading?

I'm saving an image to my server via PHP. The process can take a while as the image is of high-resolution. What I'd like to do is to display a loading/saving icon (or animated gif) while the user waits. I've taken a look at various JQuery/javascript/CSS suggestions but I can't seem to get them to work. Here is my current code without the icon:

<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
// get bytearray
$im = $GLOBALS["HTTP_RAW_POST_DATA"];

$fp = fopen('img/myImage.png', 'wb');
fwrite($fp, $im);
fclose($fp);
header('Location: http://www.mysite.com');
}  else echo 'An error occured.';

?>

Any suggestions would be greatly appreciated.

Thanks.

Community
  • 1
  • 1
Jason
  • 129
  • 11
  • Do you want to use HTML5 or something more universally supported? – Joe Phillips Jul 19 '11 at 20:35
  • Your PHP script can't do anything for this... by the time the script starts executing, the upload has completed. You need to handle this purely on the client side. – Marc B Jul 19 '11 at 20:37

1 Answers1

0

You may consider using an asynchronous uploader such as Uploadify or PLUpload. You can attach to the onUpload (or something like that) events for each and use JavaScript to display an image somewhere on the screen.

Jordan
  • 31,971
  • 6
  • 56
  • 67