Hi Gareth/Shane, Thank you both for your ideas! I didn't realize how much trouble Apache2 would give (over Apache1)...
I tried both ideas and Shane's works fine. I also tried Gareth's idea and the problem I was getting was quite unfriendly...if someone knows what's wrong, I'd be happy to know (to just satisfy my curiosity as Shane's suggestion worked). First, I had to enable apreq2 according to: http://mail-archives.apache.org/mod_mbox/perl-modperl/200604.mbox/[EMAIL PROTECTED] Then, I did this: my $contents = ''; my $req = Apache2::Request -> new ($r); my $upload = $req->upload ('foo'); my $size = $upload -> slurp($contents); and in my browser, I was getting a single message: "End of file found". Nothing recorded in error.log and nothing seemed wrong in access.log. The culprit is actually the third line as removing the fourth line generated the same message. Anyway, thank you both of you for your help! I'll keep in mind the differences between Apache 1 and Apache 2 when I look for help on the various web pages... Thanks! Ray Shane McCarron wrote: > 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 >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/mason-users >> > > > ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/mason-users

