----- Original Message -----
From: "Vuillemot, Ward W" <[EMAIL PROTECTED]>
To: "'Issac Goldstand'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 19, 2002 2:30 PM
Subject: RE: mod_perl does not see multipart POSTs
> I simplified everything to the bare bones. Nothing is getting passed. I
am
> at a complete loss. If anyone has a few minutes, just try running this.
> You should be able to point it toward a text/plain file and have it
> displayed below the file upload form.
I'm not quite sure what the full requirements are, but the following
works for me in displaying the contents of the uploaded file - this
is on Win32 with the latest mod_perl/libapreq packages.
In httpd.conf:
******************************************************
PerlModule Apache::testUpload
<Location /testUpload>
SetHandler perl-script
PerlHandler Apache::testUpload
PerlSendHeader Off
</Location>
******************************************************
and Apache/testUpload.pm is
****************************************************
package Apache::testUpload;
use strict;
##############################
### START LOADING MODULES ###
##############################
use Apache::Request ();
use CGI;
use Apache::Constants qw(:common);
##############################
### HANDLER ###
##############################
sub handler{
my $q = Apache::Request->new(shift, DISABLE_UPLOADS => 0,
POST_MAX => 20480000);
return main($q);
}
##############################
### START OF MAIN LOGIC ###
##############################
sub main{
my $q = shift;
my $status = $q->parse();
return $status unless $status == OK;
my %results = ();
my $cgi = CGI->new();
#########################
## START FORM ##
#########################
$results{content} .= $cgi->start_multipart_form;
$results{content} .= $cgi->filefield(-name=>'uploaded_file',
-default=>'starting value',
-size=>50,
-maxlength=>80);
$results{content} .= $cgi->submit();
$results{content} .= $cgi->endform;
#########################
## START UPLOAD FILE ##
#########################
my $upload = $q->upload || undef;
if ($upload) {
my $fh = $upload->fh;
my $filename = $upload->filename;
my $size = $upload->size;
$results{content} .= "Upload File<br />";
$results{content} .= "Filename: $filename<br />";
$results{content} .= "Size: $size<br />";
$results{content} .= "$_<br />" while <$fh>;
}
#########################
## START OUTPUT ##
#########################
# send results to browser
$q->send_http_header('text/html');
print $cgi->start_html('File Upload Test');
print $cgi->h1('Content') . $results{content};
print $cgi->end_html();
return OK;
}
1;
******************************************************
Apart from abbreviating the output, one difference between the
above and your original is the $q->parse() call within main().
best regards,
randy kobes