Hello!
In my database i've got a path to a php file and i wounder, how do i get the filesize of that file? If you can show me how to show it in kb and mb too i would be happy =)
Thanks!
Hello!
In my database i've got a path to a php file and i wounder, how do i get the filesize of that file? If you can show me how to show it in kb and mb too i would be happy =)
Thanks!
assuming the variable with the path to the PHP file is called $file
$i = 0;
$ext = array (' B',' KB',' MB',' GB',' TB');
$filesize = filesize ($file);
while ($filesize >= pow (1024,$i)) ++$i; $filesize = round ($filesize / pow (1024,$i-1) * 100) / 100 . $ext[$i-1];
echo 'file: ' . $file . '<br>size: ' . $filesize;