My mess with the request object at all?  Here is a fragment that works
whether you are in CGI or mod_perl or mod_perl1.99 or mod_perl 2 modes -
obviously you would want to put in some error checking for your environment:

<%args>
#name is the upload file name
$name=>undef
</%args>
my $q = $m->cgi_object() ;

my $h = $q->uploadInfo($name);

my $realFile = "$basedir/$name";

open (OUTFILE, ">$realFile");
binmode OUTFILE ;
my $buffer ;
while (my $bytesread=read($name,$buffer,1024)) {
 print OUTFILE $buffer;
}
close OUTFILE;

On 6/9/07, Gareth Kirwan <[EMAIL PROTECTED]> wrote:

It appears
> As I'm using mod_perl, instead of CGI, I gave the second code
> snippet a
> try and when I did:
>
> # create an Apache::Upload object
> my $upload = $r -> upload;
>
> it's complaining that it "Can't locate object method "upload" via
> package "Apache2::RequestRec"."
>
> I'm been trying to figure out how this came about when I was
> expecting
> an Apache2::Request object?  The only change to the code is that I'm
> using Apache2::Upload instead of Apache::Upload...but that
> can't be the
> problem, could it?  Has something changed for Apache2?  Or,
> perhaps my
> setup is wrong somewhere?

I'm surprised that $r is an Apache2::RequestRec instead of
Apache2::Request.
You're using mod_perl2, not mod_perl, I guess?

Try:

My $req = Apache2::Request->new($r);
My $upload = $req->upload('foo');

I'm just guessing, looking at:

http://search.cpan.org/~joesuf/libapreq2-2.08/glue/perl/lib/Apache2/Request
.
pm
And:

http://search.cpan.org/~pgollucci/mod_perl-2.0.3/docs/api/Apache2/RequestRec
.pod

HTH

G


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users




--
Shane McCarron
[EMAIL PROTECTED]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to