You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by ky...@pcv.cz on 2001/02/22 14:04:32 UTC
Upload file size limit
Hi,
I have this problem, on my web I´m using file upload from the web page
something like this:
<FORM METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="ImageName">
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload file">
</FORM>
......
[-
open FILE, "> /tmp/file.$$";
print FILE $buffer while read($fdat{ImageName}, $buffer, 32768);
close FILE;
-]
I would like make a size limit for the uploaded file. How to do it ?.
Thanks anyway.
Jan Kyncl
Re: Upload file size limit
Posted by "G.Richter" <ri...@ecos.de>.
> I would like make a size limit for the uploaded file. How to do it ?.
>
Use APache configuration directive LimitRequestBody, see:
http://httpd.apache.org/docs/mod/core.html#limitrequestbody
Gerald
Re: Upload file size limit
Posted by Neeme Vool <ne...@eenet.ee>.
> Hi,
>
> I have this problem, on my web I´m using file upload from the web page
> something like this:
>
> <FORM METHOD="POST" ENCTYPE="multipart/form-data">
> <INPUT TYPE="FILE" NAME="ImageName">
> <INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Upload file">
> </FORM>
> ......
> [-
> open FILE, "> /tmp/file.$$";
> print FILE $buffer while read($fdat{ImageName}, $buffer, 32768);
> close FILE;
> -]
one way is to use smaller chunks and to use code like this
while ($count=read($fdat{ImageName}, $buffer, 32768))
{
if ($total+$count>$max_allowed)
{
remove files, close handles, crash;
}
$total+=$count;
print FILE $buffer;
}
another way is to use CGI MAX_UPLOAD capabilities.
Neeme Vool