filesize
PHP function
Edit on GitHub ✎
(PHP 4, PHP 5, PHP 7, PHP 8)
Gets file size
Description
filesize(string $filename): int|false
Gets the size for the given file.
Parameters
filenamePath to the file.
Return Values
Returns the size of the file in bytes, or false (and generates an error of level E_WARNING) in case of an error.
32bit
Errors/Exceptions Failure
Examples
filesize() example
php
<?php
// outputs e.g. somefile.txt: 1024 bytes
$filename = 'somefile.txt';
echo $filename . ': ' . filesize($filename) . ' bytes';
?>