Reply to Re: exec, run until finished

Your name:

Reply:


Posted by Jerry Stuckle on 01/01/07 20:55

Andreas.Burman@gmail.com wrote:
> 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?
>

You won't be able to do it in PHP. Flash would be one possibility. But
you also need to have a way for the exec'd job to communicate back to
the flash program - which won't be easy.

This could be easier if it weren't an exec'd program - then it would be
using the http connection. As a batch program, though, this connection
isn't available to it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original 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

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