Viljo Marrandi wrote:

> Hello,
> 
> I didn't find anywhere in Net how much is browser form upload limit
> (with POST) and how much is Apache's default form data access(input)
> limit. If anyone knows where I can find this data i'd be grateful.


There is no such a limit in Apache and probably most browsers. The limit 
can be the amount of available RAM (if the file is aggregated in the 
memory) or the filesystem limits (not enough disk space, if the uploaded 
file is created on the filesystem). You can limit it within your code, 
though.


> I tested this form upload with large text and in my case only 64K went
> thru (ended up in MySQL). I saw in Apache homepage, that I could define
> POST_MAX like this:
> 
>    my $apr = Apache::Request->new($r, POST_MAX => 1024);
> 
> Err, is this 1024 bytes or kbytes?


Since CGI.pm is the base of Apache::Request (but written in Perl, 
whereas Apache::Request is written mostly in C), parts of CGI.pm's 
extensive documentation will apply for Apache::Request as well.

So if you look at CGI.pm's manpage you will see that it's in bytes:

        $CGI::POST_MAX
            If set to a non-negative integer, this variable puts a
            ceiling on the size of POSTings, in *bytes*.

            ....If CGI.pm
            detects a POST that is greater than the ceiling, it
            will immediately exit with an error message.  This
            value will affect both ordinary POSTs and multipart
            POSTs, meaning that it limits the maximum size of file
            uploads as well.  You should set this to a reasonably
            high value, such as 1 megabyte.

You are welcome to send the documentation patches to the developers of 
the Apache::Request package at [EMAIL PROTECTED] This kind of 
contribution helps a lot.


> (OT - Perl basics question) Right now I define $apr this way:
> 
> $apr = Apache::Request->new( $r->is_main ? $r : $r->main );
> 
> Now how I tell $apr that its POST_MAX = 1024?


either:

my $real_r = $r->is_main ? $r : $r->main;
my $apr = Apache::Request->new($real_r, POST_MAX => 1024);

or

$apr = Apache::Request->new( ($r->is_main ? $r : $r->main),
                              POST_MAX => 1024 );


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

Reply via email to