• PHP Video Tutorials

PHP - Function filesize()



The filesize() function can return the size of a specified file. This function can return the file size in bytes on success or false on failure.

Syntax

int filesize ( string $filename )

This function can return the size of a file in bytes or false (and can generate an error of level E_WARNING) in case of an error.

Example

<?php
   $filename = "/PhpProject/sample.txt";
   echo $filename . ': ' . filesize($filename) . ' bytes';
?>

Output

/PhpProject/sample.txt: 27 bytes
php_function_reference.htm
Advertisements