Sven wrote...

[snip]
---------------------------------------------
use Apache ();
use Apache::Request ();
$apr = Apache::Request->new($r);
foreach $parm($apr->param){
 print "->".$parm." : ".$apr->param($parm)."\n";
}
print "---------\n";
---------------------------------------------

First of all, use instance() instead of new().  I believe the documentation
for Apache::UploadMeter mentions this.

[snip]

Can someone show me an example of a "upload.pl" where a file is
stored on the server please?

Sure.  Here is the response handler for the testbed for Apache::UploadMeter
at http://epoch.beamartyr.net/umtest/form.html

package ApacheUploadMeterTest;
use Apache::Request;
use Apache::Constants qw(OK DECLINED);
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
sub handler {
    my $r=shift;
    my $q=Apache::Request->instance($r, POST_MAX=>2097152);
    # Actually, the above line doesn't work - POST_MAX will be a parameter
to
    # Apache::UploadMeter in future releases
    local($|)=1;
    my $num=0;
    print <<"PART1";
Content-Type: text/html

<HTML>
<HEAD>
<TITLE>Apache::UploadMeter Test Module</TITLE>
</HEAD>
<BODY>
<H1>Upload Complete</H1>
PART1
    foreach my $upload ($q->upload) {
        $num++;
        my $name=$upload->name;
        my $size=$upload->size;
        my $filename=$upload->filename;
        my $type=$upload->type;
        my $info=Dumper($upload->info);
        my $tempname=$upload->tempname;
        print <<"EOP"
<UL>
<LI>Upload field: $num</LI>
<LI>Detected upload field: $name</LI>
<LI>Detected filename: $filename ($size bytes)</LI>
<LI>Reported MIME type: $type</LI>
<LI>Spool file: $tempname</LI>
<LI>Other debug info: $info</LI>
</UL>
EOP
    }
    print "</BODY></HTML>\n";
    return OK;
}
1;

Hope this gets you started,
  Issac


Reply via email to