physi has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I get stuck in figuring out, how I can limit the file upload size within Mason.

I've got the following Mason code :

<%perl> my $apr = Apache::Request->instance($r,POST_MAX => 1); my $status = $apr->parse; if ($status) { print "Too big"; }else{ print "OK" </%perl>
Like in the documentation of Apache::Request I create a new instance of the magic $r object, and limit this size to 1 byte for testing.

When I call this mason dokument from within a form and upload a file bigger then 1byte I always get a OK back!?

Sure I can get the filesize of $apr with the methodes $apr->tempname and the stat this.

But as I understand the documentation, there must be a possibility to do this with the parse function.

Can anyone bring some light in my $r->darkness :-)


--the good, the bad and the physi--