Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Web Browser File Upload Progress Bar in Perl w/AJAX

by cees (Curate)
on Dec 11, 2006 at 14:01 UTC ( [id://589045] : note . print w/replies, xml ) Need Help??

in reply to Web Browser File Upload Progress Bar in Perl w/AJAX

You might want to have a look at Apache2::UploadProgress. It requires that you run mode_perl2, but it makes things a whole lot easier than what you have. In fact, you don't have to make any changes to your code to use it. You just have to load a couple of JavaScript files in your HTML page, and then add an onSubmit handler to the form and you are done.

All the magic is done with an apache filter, so your code doesn't even have to know that you are using an upload meter on the frontend.

I gave a demo of this at YAPC in Chicago and I have put my example code online, including the upload meter example.

Replies are listed 'Best First'.
Re^2: Web Browser File Upload Progress Bar in Perl w/AJAX
by skazat (Chaplain) on Dec 12, 2006 at 00:45 UTC

    That does look interesting and I'm confident (although if you could give clarification) that the hooks using mod_perl2 would get around the timeout problem with uploading hyoooge files.

    I'm currently still playing in CGI script-land, since mod_perl, not even mentioning mod_perl2 is not a environment that's in the mainstream, as far as shared hosting accounts go (which is what I usually attempt to target, le sigh). Although making a really really mature CGI app dually work as a mod_perl/cgi script is something I'll eventually try to tackle.

    Thanks for the tip, though;


    -justin simoni
    skazat me

      Most timeout problems are apache configuration, and I'd recommend not uploading files over a certain size via the web anyways. The issue becomes more "User" and less "programming" after awhile. People do not wait. You can flash a giant blinking orb with sounds saying "PLEASE WAIT WHILE THE FILE UPLOADS" and you will still get people canceling the upload because they are sick of waiting

      BTW CGI::Ajax is a nice module to use if you haven't checked it out. Also if they are uploading images, once thing you can look at is a Java or ActiveX control that allows them to paste the clipboard to the web portal. This gives you the option to set how much compression the image gets and cut down the upload option. (I've used an ActiveX control called Online Image Editor for years and it sends data to the server using Base64).

      If this does not help you at all, then hopefully it will give someone else some ideas. --

      Even smart people are dumb in most things...

        I am testing this program and it work with Firefox, but I have problem with Explorer: I don't see the progress bar.

        Have you a solution?