note 44299 deleted from function.filesize by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 20 Jul 2004 20:36:26 +0000 |
| Subject: | note 44299 deleted from function.filesize by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73736@lists.php.net to get a copy of this message | ||
Note Submitter: Jorgen Hedlund
----
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;
}
?>