Hello,

i don't get file uploads working with Apache2 with mod_perl2 and a mason
wrapper configuration.

The files:

apache vhost
============
<VirtualHost *:80 *:443>
  ServerName test.domain.tld
  DocumentRoot /tmp/test/www
  LogLevel warn
  ErrorLog /tmp/test_error.log
  PerlRequire /tmp/test/perl/startup.pl

  <FilesMatch "\.foo$">
    SetHandler perl-script
    PerlHandler  Test::Foo
  </FilesMatch>
</VirtualHost>



/tmp/test/perl/startup.pl
=========================
use CGI;
use lib qw(/tmp/test/perl);
1;



/tmp/test/perl/Test/Foo.pm
==========================
package Test::Foo;

use strict;
use HTML::Mason::ApacheHandler;

my $ah =
    HTML::Mason::ApacheHandler->new
        ( comp_root => '/tmp/test/www',
          data_dir  => '/tmp/test/tmp' );

sub handler {
    my ($req) = @_;

    return $ah->handle_request($req);
}




/tmp/test/www/test.html
=======================
<html>
<head></head>
<body>
<form action="/test.foo" method="post" enctype="multipart/form-data">
  <input type="file" size="50" name="foo" />
  <input type="submit" />
</form>
</body>
</html>




/tmp/test/www/test.foo
======================
Hello
<%once>
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Request ();
use Apache2::Upload ();
</%once>
<%init>
    my $req = Apache2::Request->new($r);
    my $upload = $req->upload('foo');
    if($upload) {
      print "Size: ".$upload->filename."\n";
    }
</%init>


Now when i load the test.html in my browser and upload a file I get the
output: "End of file found".
There are a few reports on the internet out there but none with a
working solution.

I tried to simplify the stuff as much as possible.
When using a HTML::Mason::ApacheHandler in the webserver config it
works.

The error occurs in $req->upload('foo') line.


How do i get file uploads working with this configuration?


Mario

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to