İstek PHP File Size Calculator / Dosya Boyut Hesaplayıcı (1 İzleyici)

AnonimTeam

Üye
Katıldı
Mesajlar
15
Kredi
0
Kod:
[COLOR=#ff0000][FONT=tahoma]function calcSize($bytes){[/FONT]    $fsize = $bytes;
    switch ($bytes):
        case $bytes < 1024:
            $fsize = $bytes .' B'; break;
        case $bytes < 1048576:
            $fsize = round($bytes / 1024, 2) .' KB'; break;
        case $bytes < 1073741824:
            $fsize = round($bytes / 1048576, 2) . ' MB'; break;
        case $bytes < 1099511627776:
            $fsize = round($bytes / 1073741824, 2) . ' GB'; break;
    endswitch;
    return $fsize; [FONT=tahoma]}[/FONT][/COLOR]

echo calcSize(filesize("path/to/text.txt"));


 

Bu konuyı kimler okuyor

Benzer konular

Top