filesize()

The file name is given as input and we can get the size of the file in bytes by using filesize function in PHP

echo filesize('test.htm');

Output is

130

Size of all files of directory

Here is an example to display all files sizes along with the file name of current directory. We used scandir function to list all the files.

$ar=scandir('.'); // current dir
while (list ($key, $val) = each ($ar)) {
echo $val . filesize($val). " bytes " ;
echo "<br>";
}

Your Rating





Post Comment This is for short comments only. Use the forum for more discussions.




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer