src/CarteBlanche/Library/File.php
public function getHumanSize( $decimals=2 )
    {
        $sz = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
        $factor = floor((strlen($this->getSize()) - 1) / 3);
        if ($factor >= count($sz)) $factor = count($sz)-1;
        return sprintf("%.{$decimals}f", $this->getSize() / pow(1024, $factor)) . $sz[$factor];
    }
public function getHumanSize( $decimals=2 )
    {
        $sz = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
        $factor = floor((strlen($this->getSize()) - 1) / 3);
        if ($factor >= count($sz)) $factor = count($sz)-1;
        return sprintf("%.{$decimals}f", $this->getSize() / pow(1024, $factor)) . $sz[$factor];
    }
Get the file size in human readable string

@param   int     $decimals   The decimals number to use in calculated file size
@return  string  A human readable string describing a file size