Hello my steemed code-friends!

 
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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.