libapreq2 upload question

[prev] [thread] [next] [Date index for 2004/12/19]

From: eps com estem
Subject: libapreq2 upload question
Date: 15:29 on 19 Dec 2004
I'm trying to use libapreq2 to upload files to the server.
If i'm not wrong not all methods are available from all filters, but i've had poor 

results trying to guess which phases allow what methods.

My program executes all the modules (except the SSI filtering) in the URI phase 

(PerlTransHandler).
I need to use that phase and not the PerlResponseHandler because is the executed module 

who returns the uri where client has to go, so i can't wait to more advanced phases.
And the problem is that $r->content_type returns nothing at this stage.
I've solved this problem setting the content_type in the URI module on a specific call 

before executing the other modules, so they will be able to read the content-type  

(multipart/form-data) (it doesn't like me, is there any other option?).

Then i am able to use libapreq2 with this mm-kind of data, and mp2 for the rest of 

transactions (plain text).
Passing the data with a multipart/form-data <form> i try the next:

if ($apache->content_type() eq 'multipart/form-data') {
   my $mm =3D Apache::Request->new($apache,POST_MAX=3D>50000); #50k max
   my $uploads =3D $mm->upload();
   warn $uploads.' '.%$uploads;
   my $table =3D $mm->param();
   foreach (keys %$uploads) {
      $uploads->{$_}->slurp(my $temp);
      warn $temp;
      }
   foreach (keys %$table){
      $info->{query} .=3D $_.'=3D'.$table->{$_}.'&';
      warn $_.' =3D '.$table->{$_};
      }
} else {
   if ($apache_headers->{'Content-length'} < 10000000) {
      $apache->read($info->{query},$apache_headers->{'Content-length'});
      # here there was a bug, now it runs without problems
      }
   }

While i'm able to read all text params, there are no entries in $uploads.

If i comment the first part and use the $apache->read function, i can see the binary data
sent so the file is rightly uploaded (i can see in firefox but not in explorer).
Why i am not catching this through libapreq upload function?
There are very few examples so i'm not sure if i'm doing what's supposed to do. Is there
any error in the code?
If i need to execute the libapreq functions i another phase, is there any way to modify
the uri in another phase? I've tested the push_handlers function but URI translation comes
too late and page is not found.

Apache/2.0.52 (Win32) mod_perl/1.99_17 Perl/v5.8.2
libapreq2 2.04-dev (-mod_perl-dev 1.99_15-dev)

Thanks.

---------------------------------------------------------
Esta Navidad, sé más original ¿Te atreves a enviar una postal con tu voz? http://greetingmania.ya.com
Ya.com ADSL Router Wi-Fi: Sólo 29,90 €/mes + IVA*. Router + Antivirus y firewall ¡Gratis! http://acceso.ya.com/adsl/256router

        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

libapreq2 upload question
eps com estem 15:29 on 19 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 16:18 on 19 Dec 2004

Re: libapreq2 upload question
Randy Kobes 19:31 on 19 Dec 2004

Re: libapreq2 upload question
eps com estem 08:26 on 20 Dec 2004

Re: libapreq2 upload question
Randy Kobes 15:06 on 20 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 15:18 on 20 Dec 2004

Re: libapreq2 upload question
eps com estem 20:17 on 20 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 21:31 on 20 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 22:46 on 20 Dec 2004

Re: libapreq2 upload question
eps com estem 22:53 on 20 Dec 2004

Re: libapreq2 upload question
eps com estem 23:15 on 20 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 23:46 on 20 Dec 2004

Re: libapreq2 upload question
Randy Kobes 05:37 on 21 Dec 2004

Re: libapreq2 upload question
eps com estem 08:04 on 21 Dec 2004

Re: libapreq2 upload question
Randy Kobes 15:54 on 21 Dec 2004

Re: libapreq2 upload question
Joe Schaefer 16:26 on 21 Dec 2004

Re: libapreq2 upload question
eps com estem 23:46 on 05 Jan 2005

Re: libapreq2 upload question
eps com estem 14:21 on 20 Feb 2005

Re: libapreq2 upload question
Joe Schaefer 00:33 on 21 Feb 2005

Generated at 12:48 on 22 Feb 2005 by mariachi v0.52