Skrypt pobierający rozmiar zawartości folderu
<?php function fileSizer($path) { $size = 0; if($dir = @opendir($path)) { while(($file = readdir($dir)) !== false) { if($file=='..' || $file=='.') continue; elseif( is_dir($path.'/'.$file) ) $size += dirsize($path.'/'.$file); else $size += filesize($path.'/'.$file); } closedir($dir); } else exit('nie udało się otworzyć folderu '.$path); return $size; } function b2mb($n) { return round($n/1048576,2); } $folder = 'imgs'; $ob = fileSizer($folder); echo ''.b2mb($ob).' MB'; ?>
Inne skrypty:
Kod captcha
,
Skracanie tekstu
,
Walidacja adresu e-mail
fileSizer();
by
karol-drag.eu