public function getAllowedMaxFileSize($ext = null)
    {

        // Check if there is any defined instance max file sizes
        if (empty($this->allowedMaxFileSize)) {
            // Set default max file sizes if there isn't
            $fileSize = Config::inst()->get(__CLASS__, 'default_max_file_size');
            if ($fileSize) {
                $this->setAllowedMaxFileSize($fileSize);
            } else {
                // When no default is present, use maximum set by PHP
                $maxUpload = File::ini2bytes(ini_get('upload_max_filesize'));
                $maxPost = File::ini2bytes(ini_get('post_max_size'));
                $this->setAllowedMaxFileSize(min($maxUpload, $maxPost));
            }
        }

        if ($ext !== null) {
            $ext = strtolower($ext);
            if (isset($this->allowedMaxFileSize[$ext])) {
                return $this->allowedMaxFileSize[$ext];
            }

            $category = File::get_app_category($ext);
            if ($category && isset($this->allowedMaxFileSize['[' . $category . ']'])) {
                return $this->allowedMaxFileSize['[' . $category . ']'];
            }
        }

        return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
    }
public function getAllowedMaxFileSize($ext = null)
    {

        // Check if there is any defined instance max file sizes
        if (empty($this->allowedMaxFileSize)) {
            // Set default max file sizes if there isn't
            $fileSize = Config::inst()->get(__CLASS__, 'default_max_file_size');
            if ($fileSize) {
                $this->setAllowedMaxFileSize($fileSize);
            } else {
                // When no default is present, use maximum set by PHP
                $maxUpload = File::ini2bytes(ini_get('upload_max_filesize'));
                $maxPost = File::ini2bytes(ini_get('post_max_size'));
                $this->setAllowedMaxFileSize(min($maxUpload, $maxPost));
            }
        }

        if ($ext !== null) {
            $ext = strtolower($ext);
            if (isset($this->allowedMaxFileSize[$ext])) {
                return $this->allowedMaxFileSize[$ext];
            }

            $category = File::get_app_category($ext);
            if ($category && isset($this->allowedMaxFileSize['[' . $category . ']'])) {
                return $this->allowedMaxFileSize['[' . $category . ']'];
            }
        }

        return (isset($this->allowedMaxFileSize['*'])) ? $this->allowedMaxFileSize['*'] : false;
    }
public function getAllowedMaxFileSize ( $ ext = null ) { // Check if there is any defined instance max file sizes if ( empty ( $ this -> allowedMaxFileSize ) ) { // Set default max file sizes if there isn't $ fileSize = Config :: inst ( ) -> get ( __CLASS__ , 'default_max_file_size' ) ; if ( $ fileSize ) { $ this -> setAllowedMaxFileSize ( $ fileSize ) ; } else { // When no default is present, use maximum set by PHP $ maxUpload = File :: ini2bytes ( ini_get ( 'upload_max_filesize' ) ) ; $ maxPost = File :: ini2bytes ( ini_get ( 'post_max_size' ) ) ; $ this -> setAllowedMaxFileSize ( min ( $ maxUpload , $ maxPost ) ) ; } } if ( $ ext !== null ) { $ ext = strtolower ( $ ext ) ; if ( isset ( $ this -> allowedMaxFileSize [ $ ext ] ) ) { return $ this -> allowedMaxFileSize [ $ ext ] ; } $ category = File :: get_app_category ( $ ext ) ; if ( $ category && isset ( $ this -> allowedMaxFileSize [ '[' . $ category . ']' ] ) ) { return $ this -> allowedMaxFileSize [ '[' . $ category . ']' ] ; } } return ( isset ( $ this -> allowedMaxFileSize [ '*' ] ) ) ? $ this -> allowedMaxFileSize [ '*' ] : false ; }
Get maximum file size for all or specified file extension.

@param string $ext
@return int Filesize in bytes
Get maximum file size for all or specified file extension .