You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Philip Mak <pm...@animeglobe.com> on 2002/05/27 03:13:42 UTC

How to tell FileUploadMax exceeded?

I have this in httpd.conf:

	PerlSetVar FileUploadMax 1048576
	PerlSetVar FileUploadTemp 1

I wrote this code to test file uploading:

        my $file = $Request->{FileUpload}{sjis};
        use Data::Dumper;
        print "<pre>".Dumper($file)."</pre>";

When I upload a file that's too big, it prints this:

	$VAR1 = undef;

which means that I can't tell whether (1) the user never uploaded a
file at all, or (2) the user uploaded a file that was too big.

Is the above paragraph correct? How can I tell the difference between
(1) and (2)?

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: How to tell FileUploadMax exceeded?

Posted by Joshua Chamas <jo...@chamas.com>.
Philip Mak wrote:
> 
> I have this in httpd.conf:
> 
>         PerlSetVar FileUploadMax 1048576
>         PerlSetVar FileUploadTemp 1
> 
> I wrote this code to test file uploading:
> 
>         my $file = $Request->{FileUpload}{sjis};
>         use Data::Dumper;
>         print "<pre>".Dumper($file)."</pre>";
> 
> When I upload a file that's too big, it prints this:
> 
>         $VAR1 = undef;
> 

Sorry Philip for taking so long to get back to you, I've
been on vacation & just got back...

I believe something like this will work:

if($Request->{TotalBytes} > $Server->Config('FileUploadMax')) {
  ... too big ...
} else {
  ... upload file OK if defined ...
}

if you embed a hidden field on the file upload form, it may
be also that that parameter is defined while the upload itself
is not when the user processes the form, but I have not tried
this & do not know the results.

--Josh
_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks Founder                       Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org