main/core/Library/Utilities/ClaroUtilities.php
public function getRealFileSize($fileSize)
    {
        //B goes at the end because it's always matched otherwise
        $validUnits = ['KB', 'MB', 'GB', 'TB'];
        $value = str_replace(' ', '', $fileSize);

        $pattern = '/\d+/';
        preg_match($pattern, $value, $match);

        foreach ($validUnits as $unit) {
            if (strpos($fileSize, $unit)) {
                switch ($unit) {
                    case 'B':
                        return $match[0] * pow(1024, 0);
                    case 'KB':
                        return $match[0] * pow(1024, 1);
                    case 'MB':
                        return $match[0] * pow(1024, 2);
                    case 'GB':
                        return $match[0] * pow(1024, 3);
                    case 'TB':
                        return $match[0] * pow(1024, 4);
                }
            }
        }

        return $fileSize;
    }
public function getRealFileSize($fileSize)
    {
        //B goes at the end because it's always matched otherwise
        $validUnits = ['KB', 'MB', 'GB', 'TB'];
        $value = str_replace(' ', '', $fileSize);

        $pattern = '/\d+/';
        preg_match($pattern, $value, $match);

        foreach ($validUnits as $unit) {
            if (strpos($fileSize, $unit)) {
                switch ($unit) {
                    case 'B':
                        return $match[0] * pow(1024, 0);
                    case 'KB':
                        return $match[0] * pow(1024, 1);
                    case 'MB':
                        return $match[0] * pow(1024, 2);
                    case 'GB':
                        return $match[0] * pow(1024, 3);
                    case 'TB':
                        return $match[0] * pow(1024, 4);
                }
            }
        }

        return $fileSize;
    }
public function getRealFileSize ( $ fileSize ) { //B goes at the end because it's always matched otherwise $ validUnits = [ 'KB' , 'MB' , 'GB' , 'TB' ] ; $ value = str_replace ( ' ' , '' , $ fileSize ) ; $ pattern = '/\d+/' ; preg_match ( $ pattern , $ value , $ match ) ; foreach ( $ validUnits as $ unit ) { if ( strpos ( $ fileSize , $ unit ) ) { switch ( $ unit ) { case 'B' : return $ match [ 0 ] * pow ( 1024 , 0 ) ; case 'KB' : return $ match [ 0 ] * pow ( 1024 , 1 ) ; case 'MB' : return $ match [ 0 ] * pow ( 1024 , 2 ) ; case 'GB' : return $ match [ 0 ] * pow ( 1024 , 3 ) ; case 'TB' : return $ match [ 0 ] * pow ( 1024 , 4 ) ; } } } return $ fileSize ; }
Take a formatted file size and returns the number of bytes.

@deprecated. just let the client do it for you
Take a formatted file size and returns the number of bytes .