filesize() in php

filesize() function to determine the size of a file on the hard disk

this function takes a filename as an argument

filesize( “myfile.txt” )

This returns the size of the specified file in bytes, or false upon error

Example of filesize() in php

<?php

// outputs e.g.  somefile.txt: 1024 bytes

$filename = 'somefile.txt';
echo $filename . ': ' . filesize($filename) . ' bytes';

?>

Leave a Comment