$file_size = filesize(<FILENAME>);
if ($file_size >= 1073741824) {
$file_size = round($file_size / 1073741824 * 100) / 100 . "g";
} elseif ($file_size >= 1048576) {
$file_size = round($file_size / 1048576 * 100) / 100 . "m";
} elseif ($file_size >= 1024) {
$file_size = round($file_size / 1024 * 100) / 100 . "k";
} else {
$file_size = $file_size . "b";
}
is a code snippet from the PHP manual which allows you to display the file
size rounded and then GB. MB, or KB :)
Use the absolute file path for the file you want looked at.
Jeff
----- Original Message -----
From: "Joseph Bannon" <[EMAIL PROTECTED]>
To: "PHP (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, August 28, 2001 10:37 AM
Subject: [PHP] How do I get the file size of a file on my server?
> How do I get the file size of a file on my server using PHP?
>
> Thanks,
> Joseph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]