Posted by Andreas.Burman on 01/01/07 19:48
Hi
I call a program through exec that can take a long time to execute.
This is fine but I would like to show some kind of animation or
something while the program is running and when it is finished letting
the user download the file.
Right now I'm using code similar to this simplified example:
----- index.php -----
<form method="post" action="genetate.php" target="_blank">
<input type="submit" value="Generate!"/>
</form>
----- generate.php -----
<?php
$tmpname = time() . md5("bla");
// Writes to $tmpname
exec("takesalotoftime $tmpname");
$len = filesize("$tmpname");
header('Content-type: application/postscript\r\n');
header("Content-Length: $len;\r\n");
header('Content-Disposition: attachment; filename="' . $tmpname
.. '"\r\n');
readfile("$tmpname");
?>
So what is the best way to start the exec, show an animation until it
is finished and then send the file to the user?
[Back to original message]
|