You are here: exec, run until finished « PHP Programming Language « IT news, forums, messages
exec, run until finished

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?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация