View Single Post
Old 02-04-2009, 06:33 PM  
Pics Traffic
Confirmed User
 
Pics Traffic's Avatar
 
Industry Role:
Join Date: Jun 2004
Location: Europe
Posts: 3,055
Quote:
Originally Posted by Juicy D. Links View Post
Code:
  
function formatbytes($file, $type)   
{   
    switch($type){   
        case "KB":   
            $filesize = filesize($file) * .0009765625; // bytes to KB   
        break;   
        case "MB":   
            $filesize = (filesize($file) * .0009765625) * .0009765625; // bytes to MB   
        break;   
        case "GB":   
            $filesize = ((filesize($file) * .0009765625) * .0009765625) * .0009765625; // bytes to GB   
        break;   
    }   
    if($filesize <= 0){   
        return $filesize = 'unknown file size';}   
    else{return round($filesize, 2).' '.$type;}   
}

Code:
// USAGE   
echo formatbytes("$_SERVER[DOCUMENT_ROOT]/images/large_picture.jpg", "MB");   
// would display the file size in MB

you're the man Juicy. Now do the eyebrow for me again like you did in Atlanta at the bar. I need to show you that pix Thanks Bro.
Pics Traffic is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote