Re: file Upload - checking file size before uploading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In your form uploading script:
# individual file size limit - in bytes (102400 bytes = 100KB)
$file_size_ind = "838860800"; // 819.2 MB


$weight=$_FILES[fileupload][size];

if ($weight>$file_size_ind)
{
 echo"<br><img src=\"$dir_img/error.gif\" width=\"15\"
height=\"15\">&nbsp;<b><font size=\"2\">ERROR: please get the file size
less than ".$file_size_ind." BYTES  (".round(($file_size_ind/1024),2)."
KB)</font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";
}


James Nunnerley wrote:
> Is there anyway to check the size of a file before it starts uploading it?
> For instance, if the file is huge, and takes ages to upload, and is then
> rejected by the server, the user will be somewhat annoyed!
> 
>  
> 
> I'm not even sure this is a php question!
> 
>  
> 
> Cheers
> 
> Nunners
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux