note 77014 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Sat, 02 May 2009 11:17:32 +0000 |
| Subject: | note 77014 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154119@lists.php.net to get a copy of this message | ||
Note Submitter: Radon8472
----
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