You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Dave Thomas <da...@xor.com> on 2000/07/14 18:04:57 UTC

Apache::Request::upload

Hello,

    Question: Why does the Apache::Request object not return an Upload
object when
there was a file sent.

   Backgroud: I have pulled the sample script from the Apache::Request
distribution and
used that in my handler, this instance works fine. When I try to use it
incorporated
with the object model developed here it closes up shop and goes home.

 I initialize the Apache::Request object in an init function from the
handler. This is then
used to display the templated html content with
$apr->send_http_header('text/html');
at its top. I've made certain that the Request object's address remains
the same
throughout this process. When I fill in the file field and submit the
first thing that the
script does after initializing the Request object is try to initialize
the Upload object, this
fails miserably with a return value of undef.

Any suggestions on how to proceed would be greatly appreciated.

Kind regards,
Dave Thomas
dave.thomas@xor.com

Re: Apache::Request::upload

Posted by Dave Thomas <da...@xor.com>.
The template contains the ENCTYPE="multipart/form-data",
uses METHOD="POST", and the action is my handler.

I initialize the object with:
my $r     = 'Apache'->request();
my $apr = 'Apache::Request'->new($r);


From within my local CGI class I get the Apache::Request class reference
from
the passed hash ref and set up the meta-data:
$self->{_ApacheRequest} = $args->{ApacheRequest};

This line always returns undef (but it works with the example program):
$self->{_ApacheRequestUpload} = $self->{_ApacheRequest}->upload;

I have also tried in the init object:
my $upload = $apr->upload;

Thank you,
Dave

Tobias Hoellrich wrote:

> At 10:04 AM 7/14/00 -0600, Dave Thomas wrote:
> >Hello,
> >
> >    Question: Why does the Apache::Request object not return an Upload
> >object when
> >there was a file sent.
> >
> >   Backgroud: I have pulled the sample script from the Apache::Request
> >distribution and
> >used that in my handler, this instance works fine. When I try to use it
> >incorporated
> >with the object model developed here it closes up shop and goes home.
> >
> > I initialize the Apache::Request object in an init function from the
> >handler. This is then
> >used to display the templated html content with
> >$apr->send_http_header('text/html');
> >at its top. I've made certain that the Request object's address remains
> >the same
> >throughout this process. When I fill in the file field and submit the
> >first thing that the
> >script does after initializing the Request object is try to initialize
> >the Upload object, this
> >fails miserably with a return value of undef.
> >
>
> Most likely you're missing a
>
>         ENCTYPE="multipart/form-data"
>
> in your FORM tag.
>
> Hope this helps
>   Tobias

Re: Apache::Request::upload

Posted by Tobias Hoellrich <th...@Adobe.COM>.
At 10:04 AM 7/14/00 -0600, Dave Thomas wrote:
>Hello,
>
>    Question: Why does the Apache::Request object not return an Upload
>object when
>there was a file sent.
>
>   Backgroud: I have pulled the sample script from the Apache::Request
>distribution and
>used that in my handler, this instance works fine. When I try to use it
>incorporated
>with the object model developed here it closes up shop and goes home.
>
> I initialize the Apache::Request object in an init function from the
>handler. This is then
>used to display the templated html content with
>$apr->send_http_header('text/html');
>at its top. I've made certain that the Request object's address remains
>the same
>throughout this process. When I fill in the file field and submit the
>first thing that the
>script does after initializing the Request object is try to initialize
>the Upload object, this
>fails miserably with a return value of undef.
>

Most likely you're missing a 

	ENCTYPE="multipart/form-data" 

in your FORM tag. 

Hope this helps
  Tobias