src/validators/FileValidator.php
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;
    }
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;
    }
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 ; }
Returns the maximum size allowed for uploaded files.

This is determined based on four factors:

- 'upload_max_filesize' in php.ini
- 'post_max_size' in php.ini
- 'MAX_FILE_SIZE' hidden field
- [[maxSize]]

@return int the size limit for uploaded files.
Returns the maximum size allowed for uploaded files .