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!
In reply to Upload Progress Bar by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |