Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Merry Christimas to all of you! (not sure what this date really means nowadays, but, anyway, cheers for everybody!)
I canīt find anywhere on the net - and the regular books donīt mention it - how to put a UPLOAD progress bar to show the visitor the progress of the file he is uploading.
Iīm setting up a kind of marketplace where the vendors will be able to upload his catalogs. In the script thatīs triggered by the submit, I use CGI.pm's upload method to load the data in a handle, like tradition says, and also do a lot of processing in this .txt file to check it for errors before importing it to my database.
I was thinking what kind of approach is possible and the main problems I hit are:
1) I donīt understand how can I send the user any info about the upload in the meantime the scipt (upload.cgi) runs. It has something to do with returning a "no content" header to the browser? I mean, because now the script uploads the file, checks it and, at the end, presents another page showing the results of the analysis. How can I make my script multi-task? I thought that, for example, while the upload isnīt finished, Perl is stuck in the line where I call the ->upload method. Isnīt it? Can it do other things meanwile? It has to do with setting buffering off as I suspect??
2) Also, how can I access this info about the amount of the file that has already been uploaded by CGI.pm? Is it available through any variable?
3) Ok, if I manage my script to be multi-task, and talk with the userīs browser while it uploads the file, telling it not to move untill the processing finishes and finally I can show the analyss page, how do I manage to have the already-loaded page to suddenly go alive by itself showing the status? Through javascript? Java? Flash? How to make the progress bar a REAL progress bar, I mean, showing the real progress and not running the risk of showing 70% when the upload is in fact already done?
Hey, can anyone therehelp me out on this? Iīm completely lost. Iīm becoming very confortable with Perl processing that uses traditional CGI calls and resources, but this one is far away from my reach now. My only hope is thy wisdom, perlmonks!
Thanks a lot, folks!
André
Greetings from Brazil!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Upload Progress Bar
by Aristotle (Chancellor) on Dec 25, 2004 at 06:18 UTC | |
by Anonymous Monk on Jan 12, 2005 at 17:13 UTC | |
|
Re: Upload Progress Bar
by redhotpenguin (Deacon) on Dec 25, 2004 at 19:22 UTC | |
by Anonymous Monk on Dec 26, 2004 at 02:40 UTC | |
by redhotpenguin (Deacon) on Dec 26, 2004 at 06:46 UTC | |
|
Re: Upload Progress Bar
by zentara (Cardinal) on Dec 25, 2004 at 11:14 UTC | |
|
Re: Upload Progress Bar
by superfrink (Curate) on Dec 27, 2004 at 09:09 UTC | |
|
Re: Upload Progress Bar
by TedPride (Priest) on Dec 27, 2004 at 07:26 UTC | |
|
Re: Upload Progress Bar
by JSchmitz (Canon) on Dec 27, 2004 at 13:47 UTC | |
by Andre_br (Pilgrim) on Dec 27, 2004 at 22:15 UTC | |
|
Re: Upload Progress Bar
by mkirank (Chaplain) on Dec 27, 2004 at 09:55 UTC | |
|
Re: Upload Progress Bar
by Qiang (Friar) on Dec 28, 2004 at 07:28 UTC | |
|
Re: Upload Progress Bar
by Anonymous Monk on Dec 29, 2004 at 15:58 UTC |