Dear Monks:

I'm trying to develop something that can let me show a progress bar or a progress percentage field when a user uploads a file to my server.

I'm working over mod_perl 2 (with Apache 2.2). So far, I have only found ways to read the uploaded file using CGI.pm or by reading the request directly (e.g. $r->read($buffer, $ENV{CONTENT_LENGTH}).

However, I'm not getting anywhere with this, since Apache seems to read all the request body before my script can even do anything. So, by the time my handler finally starts processing the upload, the file is already in the server (meaning Apache has already read the entire request body), so all I can return is "100% loaded".

I'm looking for help on how to be able to make a mod_perl handler do its processing while Apache is actually reading the request, so I can make it store the progress somehow (e.g. in a database based on a request id) and letting a different request (e.g. some AJAX code) retrieve the actual progress of the file upload.

Can anybody please help me with some wisdom?

Thank you very much.


In reply to Uploading files showing a progress bar - Apache 2.2 and mod_perl by Zarabozo

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.