P is for Practical | |
PerlMonks |
Re: About how PERL scripts executeby Macphisto (Hermit) |
on Feb 10, 2003 at 20:20 UTC ( [id://234229]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|