public static function UploadedFile::getMaxFilesize

Returns the maximum size of an uploaded file as configured in php.ini

Return value

int The maximum size of an uploaded file in bytes

4 calls to UploadedFile::getMaxFilesize()
Client::filterFiles in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php
Filters an array of files.
FileValidator::validate in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/FileValidator.php
Checks if the passed value is valid.
FileValidatorTest::uploadedFileErrorProvider in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php
UploadedFile::getErrorMessage in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php
Returns an informative upload error message.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php, line 263

Class

UploadedFile
A file uploaded through a form.

Namespace

Symfony\Component\HttpFoundation\File

Code

public static function getMaxFilesize() {
  $max = strtolower(ini_get('upload_max_filesize'));
  if ('' === $max) {
    return PHP_INT_MAX;
  }
  if (preg_match('#^\\+?(0x?)?(.*?)([kmg]?)$#', $max, $match)) {
    $shifts = array(
      '' => 0,
      'k' => 10,
      'm' => 20,
      'g' => 30,
    );
    $bases = array(
      '' => 10,
      '0' => 8,
      '0x' => 16,
    );
    return intval($match[2], $bases[$match[1]]) << $shifts[$match[3]];
  }
  return 0;
}