public function getSize()
    {
        $filePath = $this->getPathname();
        $size = -1;
        $isWin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
        $execWorks = (function_exists('exec') && !ini_get('safe_mode') && exec('echo EXEC') == 'EXEC');
        if ($isWin) {
            if ($execWorks) {
                $cmd = "for %F in (\"$filePath\") do @echo %~zF";
                exec($cmd, $output);
                if (is_array($output)) {
                    $result = trim(implode("\n", $output));
                    if (ctype_digit($result)) {
                        $size = $result;
                    }
                }
            }
            // try the Windows COM interface if its fails
            if (class_exists('COM') && $size > -1) {
                $fsobj = new \COM('Scripting.FileSystemObject');
                $file = $fsobj->GetFile($filePath);
                $result = $file->Size;
                if (ctype_digit($result)) {
                    $size = $result;
                }
            }
        } else {
            $result = trim("stat -c%s $filePath");
            if (ctype_digit($result)) {
                $size = $result;
            }
        }
        if ($size < 0) {
            $size = filesize($filePath);
        }
        return $size;
    }
public function getSize()
    {
        $filePath = $this->getPathname();
        $size = -1;
        $isWin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
        $execWorks = (function_exists('exec') && !ini_get('safe_mode') && exec('echo EXEC') == 'EXEC');
        if ($isWin) {
            if ($execWorks) {
                $cmd = "for %F in (\"$filePath\") do @echo %~zF";
                exec($cmd, $output);
                if (is_array($output)) {
                    $result = trim(implode("\n", $output));
                    if (ctype_digit($result)) {
                        $size = $result;
                    }
                }
            }
            // try the Windows COM interface if its fails
            if (class_exists('COM') && $size > -1) {
                $fsobj = new \COM('Scripting.FileSystemObject');
                $file = $fsobj->GetFile($filePath);
                $result = $file->Size;
                if (ctype_digit($result)) {
                    $size = $result;
                }
            }
        } else {
            $result = trim("stat -c%s $filePath");
            if (ctype_digit($result)) {
                $size = $result;
            }
        }
        if ($size < 0) {
            $size = filesize($filePath);
        }
        return $size;
    }
public function getSize ( ) { $ filePath = $ this -> getPathname ( ) ; $ size = - 1 ; $ isWin = ( strtoupper ( substr ( PHP_OS , 0 , 3 ) ) == 'WIN' ) ; $ execWorks = ( function_exists ( 'exec' ) && ! ini_get ( 'safe_mode' ) && exec ( 'echo EXEC' ) == 'EXEC' ) ; if ( $ isWin ) { if ( $ execWorks ) { $ cmd = "for %F in (\"$filePath\") do @echo %~zF" ; exec ( $ cmd , $ output ) ; if ( is_array ( $ output ) ) { $ result = trim ( implode ( "\n" , $ output ) ) ; if ( ctype_digit ( $ result ) ) { $ size = $ result ; } } } // try the Windows COM interface if its fails if ( class_exists ( 'COM' ) && $ size > - 1 ) { $ fsobj = new \ COM ( 'Scripting.FileSystemObject' ) ; $ file = $ fsobj -> GetFile ( $ filePath ) ; $ result = $ file -> Size ; if ( ctype_digit ( $ result ) ) { $ size = $ result ; } } } else { $ result = trim ( "stat -c%s $filePath" ) ; if ( ctype_digit ( $ result ) ) { $ size = $ result ; } } if ( $ size < 0 ) { $ size = filesize ( $ filePath ) ; } return $ size ; }
return file size in bytes

@return      int                 filesize in bytes or -1 if it fails
return file size in bytes