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="genetat e.php" target="_blank" >
<input type="submit" value="Generate !"/>
</form>
----- generate.php -----
<?php
$tmpname = time() . md5("bla");
// Writes to $tmpname
exec("takesalot oftime $tmpname");
$len = filesize("$tmpn ame");
header('Content-type: application/postscript\r\n' );
header("Content-Length: $len;\r\n");
header('Content-Disposition: attachment; filename="' . $tmpname
.. '"\r\n');
readfile("$tmpn ame");
?>
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?
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="genetat e.php" target="_blank" >
<input type="submit" value="Generate !"/>
</form>
----- generate.php -----
<?php
$tmpname = time() . md5("bla");
// Writes to $tmpname
exec("takesalot oftime $tmpname");
$len = filesize("$tmpn ame");
header('Content-type: application/postscript\r\n' );
header("Content-Length: $len;\r\n");
header('Content-Disposition: attachment; filename="' . $tmpname
.. '"\r\n');
readfile("$tmpn ame");
?>
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?
Comment