Hi Hui Liu -

> > Not sure about that error, but by any chance are you trying to read
> > POSTed data from the request?  If so, all you need to do is:
> > 
> >    my $content;
> >    $r->read($content, $r->header_in('Content-length'));
> > 
> > (mod_perl cookbook recipe 3.6)
> 
> Thanks for the suggestion. Does this mean if we have a 20MB file,
> this "read" will load the entire file into the memory?

Yes, at least up to the size limit defined by POST_MAX.  But if you're
trying to read uploaded files, don't do it like that.  Instead do it like
recipe 3.8 which shows how to get a filehandle to the uploaded file, e.g.
something like:

   use Apache::Request;
   sub handler {
      my $r = Apache::Request->new(shift,
                                   POST_MAX => 20 * 1024 * 1024,
                                   DISABLE_UPLOADS => 0);
      foreach my $upload ($r->upload) {
         my $fh = $upload->fh;
         ...
      }
   }


Larry Leszczynski
[EMAIL PROTECTED]

Reply via email to