On Mon, 2003-10-27 at 17:36, Stas Bekman wrote:
> Volker Kroll wrote:
> > Hi,
> >
> > how do I enable File-uploads in mod_perl1.99 for Apache2?
> > In Apache 1.3 I had to change some variables in Apache::Request but
> > Apache::Request is not ported right now. How do I do it? I looked in the
> > documentation, but it was not mentioned there, so, perhaps you can help
> > me.
>
> There is an alpha version of Apache::Request that you may want to try and help
> testing it so it'll get released sooner. See: http://httpd.apache.org/apreq/
>
> Meanwhile you can use CGI.pm or some other module to upload files.
Thanks Stas.
I now use CGI.pm for the upload:
sub uploadFile {
my $cgi = new CGI;
$CGI::POST_MAX= 60 * 1024 * 1024; # 24MB
$CGI::DISABLE_UPLOADS = 0;
my $request = shift;
my $file = $cgi->upload('ImageName');
my $filename = $cgi->param('ImageName');
my $tempdir = $FILEPATH . $ProjectId . '/';
$tempdir .= $params->{PageId}. '/';
my $resultfile = $tempdir . $filename;
open FILE, ">$resultfile" or log_error("Error while opening
ImageFile $!");
my $fh = $file; #->fh;
my $size = 0;
my $oldsize = 0;
my $i = 0;
while (<$fh>) {
print FILE $_;
}
close FILE or log_error("Error while closing ImageFile $!");
}
This works fine. Perhaps I will give Apache::Request a try in the next
week.
Regards
Volker