From: wosch Date: Thu, 16 Apr 2009 18:09:44 +0000 (+0000) Subject: Fix upload function in Apache2.x, the bug is descripted in X-Git-Tag: CPAN-v1.02~54^2~163 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=7dfd70e4ada1ee9bc481ebda948cb952bb2e4372;p=irspy-moved-to-github.git Fix upload function in Apache2.x, the bug is descripted in http://www.mail-archive.com/mason-users@lists.sourceforge.net/msg00744.html --- diff --git a/web/conf/apache2.0/cfspy.conf b/web/conf/apache2.0/cfspy.conf index 5ac65cc..922095c 100644 --- a/web/conf/apache2.0/cfspy.conf +++ b/web/conf/apache2.0/cfspy.conf @@ -1,4 +1,4 @@ -# $Id: cfspy.conf,v 1.2 2009-04-15 18:23:02 wosch Exp $ +# $Id: cfspy.conf,v 1.3 2009-04-16 18:09:44 wosch Exp $ # # Sample configuration for running an IRSpy web-site under Apache 2.x. # @@ -27,6 +27,9 @@ SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler + + PerlSetVar MasonArgsMethod mod_perl + PerlAddVar MasonCompRoot "private => /home/wosch/indexdata/irspy/web/htdocs" PerlSetVar MasonDataDir /home/wosch/indexdata/irspy/web/data PerlSetVar IRSpyLibDir /home/wosch/indexdata/irspy/lib diff --git a/web/htdocs/details/upload.mc b/web/htdocs/details/upload.mc index 6497266..5a5aab3 100644 --- a/web/htdocs/details/upload.mc +++ b/web/htdocs/details/upload.mc @@ -1,4 +1,4 @@ -%# $Id: upload.mc,v 1.2 2007-07-17 14:31:54 mike Exp $ +%# $Id: upload.mc,v 1.3 2009-04-16 18:09:44 wosch Exp $ <%args> $filename => undef @@ -23,7 +23,23 @@ $filename => undef % return; % } <%perl> -my $fin = $r->upload()->fh(); + +my $fin; + +# Apache2.0 +if ($r->isa('Apache2::RequestRec')) { + require Apache2::Request; + require Apache2::Upload; + my $req = new Apache2::Request($r); + my $upload = $req->upload('filename'); + $fin = $upload->fh(); +} + +# Apache 1.3 +else { + $fin = $r->upload()->fh(); +} + if (!defined $fin) { $m->comp("/details/error.mc", msg => "Upload cancelled"); return;