note 77014 modified in function.filesize by felipe
| From: | felipe@php.net | Date: | Sat, 29 Mar 2008 16:01:42 +0000 |
| Subject: | note 77014 modified in function.filesize by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137723@lists.php.net to get a copy of this message | ||
the fastest way to get the correct filesize in windows an linux would be this:
<?php
echo sprintf("%u", filesize($file));
?>
It prints the result of filesize as UNSIGNED INT so it can be until 4GB.
The reason is, SIGNED INT runs until 2GB and flips to -2GB watch following:
file<2GB = SIGNED: 1048576512 UNSIGNED: 1048576512
file>2GB = SIGNED: -2100140103 UNSIGNED: 2194827193
file<4GB = SIGNED: -100662784 UNSIGNED: 4194304512
p.s. I found this at: http://www.php.net/manual/en/function.filesize.php
--was--
the fastest way to get the correct filesize in windows an linux would be this:
<?php
echo sprintf("%u", filesize($file));
?>
It prints the result of filesize as UNSIGNED INT so it can be until 4GB.
The reason is, SIGNED INT runs until 2GB and flips to -2GB watch following:
file<2GB = SIGNED: 1048576512 UNSIGNED: 1048576512
file>2GB = SIGNED: -2100140103 UNSIGNED: 2194827193
file>4GB = SIGNED: -100662784 UNSIGNED: 4194304512
p.s. I found this at: http://www.php.net/manual/en/function.filesize.php
http://php.net/manual/en/function.filesize.php