I have been struggeling on how to get the valid filesize of a file that is >= 2 GB in PHP.

Example
Here I am checking the filesize of a file that is 3,827,394,560 bytes large with the filesize() function:

echo "The file is " . filesize('C:\MyFile.rar') . " bytes.";

Result
This is what it returns:

The file is -467572736 bytes.

Background
PHP uses signed integers, which means that the maximum number it can represent is 2,147,483,647 (+/- 2 GB).
This is where it is limited.

Edit
Report