On 5/2/06, Ron Savage <[EMAIL PROTECTED]> wrote:
> Does what work for Registry scripts?  If you are talking

Sorry, should have spelled it out.

Apache2::UploadMeter? Ahh, I see on CPAN: Apache2::UploadProgress.

I meant: Did Apache2::UploadProgress work when called from code which is not a
mod_perl handler? The answer is Yes!

In case anyone is interested in seeing how easy it is to setup, here
is all you need to add an uploadmeter to your form using
Apache2::UploadProgress:

Add these two lines to your apache2 config file and restart:

PerlLoadModule             Apache2::UploadProgress
PerlPostReadRequestHandler Apache2::UploadProgress

Load the following script and css file in your HTML document (they
magically exist on your apache server if you load the
Apache2::UploadProgress module, no need to copy the files anywhere):

<script src="/UploadProgress/progress.js"></script>
<link type="text/css" href="/UploadProgress/progress.css"/>

And then in your HTML <form> tag add this onsubmit call:

onsubmit="return startPopupProgressBar(this)"

Or if you want to embed the uploadmeter in the page, use this onsubmit
call and add an extra <div> to the page:

onsubmit="return startEmbeddedProgressBar(this)"

<div id="progress"></div>

That is all that is needed.  The script that processes the form does
not need to be changed at all, in fact, it doesn't even know that an
uploadmeter is being used, and it shouldn't care about it.  Apache and
mod_perl handle everything behind the scenes.

Here is a full example:

<script src="/UploadProgress/progress.js"></script>
<link type="text/css" href="/UploadProgress/progress.css"/>
<form action="/cgi-bin/script.cgi"
      method="post"
      enctype="multipart/form-data"
      onsubmit="return startEmbeddedProgressBar(this)">
<input type="file" name="file"/>
<input type="submit" name=".submit"/>
</form>
<div id="progress"></div>

Paste that into an HTML page and give it a whirl!  Or try the demos:

http://cees.crtconsulting.ca/perl/examples/uploadprogress/embedded.cgi
http://cees.crtconsulting.ca/perl/examples/uploadprogress/popup.cgi

Cheers,

Cees

ps If anyone is interested in helping out with this module, please
speak up.  There is a TODO file with stuff that is in the works.  I'd
also love to see more CSS stylesheets for different types of progress
bars.  Or, if you are just trying it out, let me know what you
think...

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to