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>";
}

Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com




    Post your comments , suggestion , error , requirements etc here .




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer