note 44299 added to function.filesize
| From: | JorgenHedlund at rn2 dot php dot net | Date: | Tue, 20 Jul 2004 20:11:12 +0000 |
| Subject: | note 44299 added to function.filesize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73732@lists.php.net to get a copy of this message | ||
I've discovered that filesize() returns a negative number whenever the real filesize exceeds
2147483647 bytes (it's an int that's returned and it's signed). I made a small
workaround for this, to allow for larger filesizes (tested up to 4294967295 bytes).
<?php
function _filesize($file)
{
$INT_MAX = 2147483647;
$fs = filesize($file);
if ($fs < 0) { $fs=$INT_MAX+($INT_MAX+$fs)+2; }
return $fs;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.filesize.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44299
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44299&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44299&report=yes
Search -- http://master.php.net/manage/user-notes.php