CodeIgniter Forums
progress bar for long running script - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: progress bar for long running script (/showthread.php?tid=5315)



progress bar for long running script - El Forum - 01-16-2008

[eluser]BlueCamel[/eluser]
I'm building a site that will have a long running process and want to give the user feedback as to the status. The process operates on a file uploaded or selected off a remote server. The file in question could be between 300 and 600 MB and I need to process each line and update a mysql db as appropriate. I've got this working by doing the following

1) first page shows an upload/file select
2) if the upload or file read is successful, show the /view/success.php page
3) on /view/success.php, use AJAX (jquery) to run two processes:

a) call /file/parser controller to process the file uploaded or selected
b) call /file/progress controller to monitor the process of the /file/parser script
c) when /file/parser completes, load a /view/file page for processing results.

I communicate by simply having /file/parser write a percentage complete into a mysql tmp table and /file/progress monitor it and update the progress bar on the page view.

Yes, it really all works. But is it sane? How would you go about monitoring the progress on a script that could run for 120 to 200 seconds before showing final results?