Get POST max file size

@return integer
763528
private function getUploadMaxFileSize()
    {
        $postMaxSize = trim(ini_get('post_max_size'));

        if ('' === $postMaxSize) {
            $postMaxSize = PHP_INT_MAX;
        }

        switch (strtolower(substr($postMaxSize, -1))) {
            /** @noinspection PhpMissingBreakStatementInspection */
            case 'g':
                $postMaxSize *= 1024;
            /** @noinspection PhpMissingBreakStatementInspection */
            case 'm':
                $postMaxSize *= 1024;
            case 'k':
                $postMaxSize *= 1024;
        }

        return min(UploadedFile::getMaxFilesize(), (int) $postMaxSize);
    }
150102
public function size() : int
    {
        if ($this->bufSize == null) {
            $this->bufSize = strlen($this->buf);
        }
        return $this->bufSize;
    }
765677
static function maxLogSize()
    {
        if ( isset( $GLOBALS['eZDebugMaxLogSize'] ) )
        {
            return $GLOBALS['eZDebugMaxLogSize'];
        }
        else if ( defined( 'EZPUBLISH_LOG_MAX_FILE_SIZE' ) )
        {
            self::setMaxLogSize( (int)EZPUBLISH_LOG_MAX_FILE_SIZE );
            return (int)EZPUBLISH_LOG_MAX_FILE_SIZE;
        }
        return self::MAX_LOGFILE_SIZE;
    }
761944
public static function maxUpload() {
        $maxUpload = (int)(ini_get('upload_max_filesize'));
        $max_post = (int)(ini_get('post_max_size'));
        $memory_limit = (int)(ini_get('memory_limit'));
        $upload_mb = min($maxUpload, $max_post, $memory_limit);
        return $upload_mb;
    }
922751
public function get_file_size($source) {
        // TODO MDL-33297 remove this function completely?
        $browser    = get_file_browser();
        $params     = unserialize(base64_decode($source));
        $contextid  = clean_param($params['contextid'], PARAM_INT);
        $fileitemid = clean_param($params['itemid'], PARAM_INT);
        $filename   = clean_param($params['filename'], PARAM_FILE);
        $filepath   = clean_param($params['filepath'], PARAM_PATH);
        $filearea   = clean_param($params['filearea'], PARAM_AREA);
        $component  = clean_param($params['component'], PARAM_COMPONENT);
        $context    = context::instance_by_id($contextid);
        $file_info  = $browser->get_file_info($context, $component, $filearea, $fileitemid, $filepath, $filename);
        if (!empty($file_info)) {
            $filesize = $file_info->get_filesize();
        } else {
            $filesize = null;
        }
        return $filesize;
    }
1173142
public function fullByteSize()
    {
        $size = $this->byteSize();
        foreach ($this->members as $variable) {
            $size += $variable->fullByteSize();
        }
        return $size;
    }
262878
public function getSizeLimit()
    {
        // Get the lowest between post_max_size and upload_max_filesize, log a warning if the first is < than the latter
        $limit = $this->sizeToBytes(ini_get('upload_max_filesize'));
        $postLimit = $this->sizeToBytes(ini_get('post_max_size'));
        if ($postLimit > 0 && $postLimit < $limit) {
            Yii::warning('PHP.ini\'s \'post_max_size\' is less than \'upload_max_filesize\'.', __METHOD__);
            $limit = $postLimit;
        }
        if ($this->maxSize !== null && $limit > 0 && $this->maxSize < $limit) {
            $limit = $this->maxSize;
        }

        if (($request = Yii::getApp()->getRequest()) instanceof \yii\web\Request) {
            $maxFileSize = Yii::getApp()->getRequest()->getParsedBodyParam('MAX_FILE_SIZE', 0);
            if ($maxFileSize > 0 && $maxFileSize < $limit) {
                $limit = (int)$maxFileSize;
            }
        }

        return $limit;
    }
308300
protected function getResourceLength(): int
    {
        if (null === $this->fileName) {
            return parent::getResourceLength();
        }

        if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
            return filesize(substr($this->fileName, 16));
        } elseif (substr($this->fileName, 0, 17) === 'compress.bzip2://') {
            return filesize(substr($this->fileName, 17));
        }

        return parent::getResourceLength();
    }
229117
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;
    }
341941
private function getPostedFile()
    {
        $file = $this->request->files->get('file');
        if ($file === null) {
            throw new UserMessageException(t('Please specify the file to be analyzed'));
        }
        if (!$file->isValid()) {
            throw new UserMessageException($file->getErrorMessage());
        }
        if ($this->maxFileSize) {
            $filesize = @filesize($file->getPathname());
            if ($filesize !== false && $filesize > $this->maxFileSize) {
                throw new UserMessageException(t('The uploaded file is too big'));
            }
        }

        return $file;
    }
1037228
public static function determineFileUploadMaxSize() {
		static $maxSize = -1;
	
		if ($maxSize < 0) {
			// Start with post_max_size.
			$maxSize = self::parsePhpIniSize(ini_get('post_max_size'));
	
			// If upload_max_size is less, then reduce. Except if upload_max_size is
			// zero, which indicates no limit.
			$upload_max = self::parsePhpIniSize(ini_get('upload_max_filesize'));
			if ($upload_max > 0 && $upload_max < $maxSize) {
				$maxSize = $upload_max;
			}
		}
		return $maxSize;
	}
977068
public function maxLength()
    {
        if ($this->maxLength === null) {
            $this->maxLength = $this->defaultMaxLength();
        }

        return $this->maxLength;
    }
720599
public function max()
    {
        if (!isset($this->meta['max'])) {
            $this->meta['max'] = (int) @max($this->get());
        }

        return $this->meta['max'];
    }
1242583
public static function maxBytesUpload ()
		{
			$values = [
				ini_get('post_max_size'),
				ini_get('upload_max_filesize'),
				ini_get('memory_limit'),
			];

			$min = false;
			foreach ($values as $v)
			{
				if ($v != -1)
				{
					$bytes = self::toBytes($v);
					if ($bytes != null)
						$min = $min ? min($min, $bytes) : $bytes;
				}
			}

			return $min ? $min : null;
		}
1104668
private static function determineMaximumUploadSize() {
		$postMaxSize = self::parseIniSize(
			\ini_get('post_max_size')
		);

		if ($postMaxSize <= 0) {
			$postMaxSize = \PHP_INT_MAX;
		}

		$memoryLimit = self::parseIniSize(
			\ini_get('memory_limit')
		);

		if ($memoryLimit === -1) {
			$memoryLimit = \PHP_INT_MAX;
		}

		return \min(
			self::parseIniSize(
				\ini_get('upload_max_filesize')
			),
			$postMaxSize,
			$memoryLimit
		);
	}
1091566
private function getSassMaxAge()
    {
        if (is_null($this->sassPath)) {
            $this->findPaths();
            $this->checkPaths();
        }
        return $this->getFilesMaxAge($this->sassPath, array('*.sass', '*.scss'));
    }
334581
public function getRootTotalSize() {
        $path = rtrim($this->path_to_files, '/') . '/';
        $result = $this->getDirSummary($path);
        return $result['size'];
    }