Apache::UploadMeter - Apache module which implements an upload meter for form-based uploads
XML-based graphical meter (in httpd.conf)
PerlLoadModule Apache::UploadMeter <UploadMeter MyUploadMeter> UploadForm /form.html UploadHandler /perl/upload UploadMeter /perl/meter MeterType XML </UploadMeter> (in /form.html) <!--#uploadform--> <INPUT TYPE="FILE" NAME="theFile"/> <INPUT TYPE="SUBMIT"/> </FORM>
Web 2.0 JS-based graphical meter (in httpd.conf)
PerlLoadModule Apache::UploadMeter <UploadMeter MyUploadMeter> UploadForm /form.html UploadHandler /perl/upload UploadMeter /perl/meter MeterType JSON </UploadMeter> (in /form.html) <FORM ACTION="/perl/upload" ENCTYPE="multipart/form-data" METHOD="POST" class="uploadform"> <INPUT TYPE="FILE" NAME="theFile"/> <INPUT TYPE="SUBMIT"/> </FORM> <DIV class="uploadmeter"></DIV>
An online demo of a (fairly) up-to-date version of the progress meter can be seen at http://uploaddemo.beamartyr.net/ [To conserve bandwidth, this URL won't allow more than 5MB of uploaded data. An attempt to upload more than that will cause the upload to be prematurely canceled, so try to ensure the total size of the files to be uploaded there is less than 5MB]
Apache::UploadMeter is a mod_perl module which implements a status-meter/progress-bar to show realtime progress of uploads done using a form with enctype=multipart/form-data.
The software includes several built-in DHTML widgets to display the progress bar out-of-the box, or alternatively you can create your own custom widgets.
To use the XML/XSL powered widget, simply replace the existing opening <FORM> tag, with the a special directive <!--#uploadform-->.
NOTE: To use this module, mod_perl MUST be built with StackedHandlers enabled.
Configuration is done in httpd.conf using <UploadMeter> sections which contain the URLs needed to manipulate each meter. Currently multiple meters are supported with the drawback that they must use distinct URLs (eg, you can't have 2 meters with the same UploadMeter path).
In a future version, if no name is given, a unique symbol will be generated for the meter.
Each UploadMeter section requires at least 2 sub-parameters
This should point to the URI on the server which contains the upload form with the special <!--#uploadform--> tag. Note that there should NOT be an opening <FORM> tag, but there SHOULD be a closing </FORM> tag on the HTML page.
This should point to the target (eg, ACTION) of the upload form. The target should already exist and do something useful.
This should point to an unused URI on the server. This URI will be used to provide the progress-meter data. If legacy XML/XSL mode is used, this will also provide the actual meter window.
Optional parameter specifying the type of pre-bundled meter (see "BUILT-IN TYPES" below). If this parameter is omitted, JSON is assumed as the default value.
Optional set of parameters for the meter (space delimited). Can include one or more of the following:
Current requred libraries are:
Prototype-1.5.0 Behaviour-1.1 Scriptaculous-1.7.0
Apache::UploadMeter comes pre-bundled with 2 DHTML-based graphical meters that can be used as-is, or just as reference points for builing your own custom meters. Currently the 2 types can be selected by specifying JSON or XML in the MeterType configuration directive. Each of these will cause Apache::UploadMeter to add relevant code to your upload form page.
Additionally, NONE can be specified, which will allow you to customize your user-experience without using any of the built-in meters. To use this, you must define your own widget, and query the UploadMeter URL on your own.
The UploadMeter currently accepts the following parameter:
This determines the data format that the meter will return. Currently JSON can be specified to return a JSON structure, otherwise an XML structure will be returned. See "DATA FORMAT", above.
This is a boolean (0 or 1) value used to help reduce race conditions when a new upload is initiated. If it is 0 or not defined, the server will cause the request to block (for up to 15 seconds by default - overridable by setting $Apache::UploadMeter::TIMEOUT) until the uploading content is detected by the server and the meter's datastructure is initialized. If it is 1, and the meter_id is not found on the server, a 404 error will be immediately returned.
Beginning from version 0.99_01, this module is only compatible with Apache2/mod_perl2 Support for Apache 1.3.x is discontinued, as it's too damn complicated to configure in Apache 1.3.x This may change in the future, but I doubt it; servers are slowly but surely migrating from 1.3 to 2.x Maybe it's finally time for you to upgrade too.
Copyright (c) 2001-2007 Issac Goldstand <email@example.com> - All rights reserved.
This library is free software. It can be redistributed and/or modified under the same terms as Perl itself.
This software contains third-party components licensed under BSD and MIT style open-source licenses.