I ended up having to use a wee bit of Javascript to get this going. Firstly, I was doing it in mod_perl, so I don't know how well it'll translate into your project, but hopefully it'll help.
Each user that logged in got a 10 digit alphanumberic session ID ( $session_id ) associated with him and passed around as part of his cookie. I also had Apache::Request spool to a temporary directory with the TEMP_DIR parameter set to /tmp/$session_id. This gave me a quasi-unique( yes, the possibility exists that there would be a collision ) directory that I could query the size of. When the user clicked the submit button I used a window.open( There's the javascript, I don't like its inclusion, but it works ) to pop-up a smallish window that would execute a subroutine to check the size of the directory /tmp/$session_id, and report in in MBs to the user. One thing that I wasn't able to do was actually create a progress bar. The hitch was that I had no prior knowledge of the file size before I was querying the size of the directory the file was being uploaded to. Apache::Request
will report the size of the file uploaded, but only after the file has been uploaded. If you could somehow attain the filesize before the file is uploaded, you'd be able to knock out a quick GD script to show a progress bar. If you do figure out how to do that( short of user input ) please, let me know. I'd be most interested. My solution is, by no means elegant, but it works. And the requirment my boss gave me was that it worked. Elegance, sadly had to take a back seat.
I hope this helps.
Mac
Everyone has their demons...you just happen to be mine.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.