This function returns the size in bytes for any path (folder/file).
PHP get folder or file size
#bytes#directory#file#folder#kb#mb#size
Format bytes into KB, MB, GB, …
= 1024 && $i < count($unit)-1; $i++){ $size /= 1024; } return round($size, $precision).' '.$unit[$i]; }