You are here

public static function UploadedFile::getMaxFilesize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/File/UploadedFile.php \Symfony\Component\HttpFoundation\File\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 vendor/symfony/http-kernel/Client.php
Filters an array of files.
FileValidator::validate in vendor/symfony/validator/Constraints/FileValidator.php
Checks if the passed value is valid.
FileValidatorTest::uploadedFileErrorProvider in vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php
UploadedFile::getErrorMessage in vendor/symfony/http-foundation/File/UploadedFile.php
Returns an informative upload error message.

File

vendor/symfony/http-foundation/File/UploadedFile.php, line 243

Class

UploadedFile
A file uploaded through a form.

Namespace

Symfony\Component\HttpFoundation\File

Code

public static function getMaxFilesize() {
  $iniMax = strtolower(ini_get('upload_max_filesize'));
  if ('' === $iniMax) {
    return PHP_INT_MAX;
  }
  $max = ltrim($iniMax, '+');
  if (0 === strpos($max, '0x')) {
    $max = intval($max, 16);
  }
  elseif (0 === strpos($max, '0')) {
    $max = intval($max, 8);
  }
  else {
    $max = (int) $max;
  }
  switch (substr($iniMax, -1)) {
    case 't':
      $max *= 1024;
    case 'g':
      $max *= 1024;
    case 'm':
      $max *= 1024;
    case 'k':
      $max *= 1024;
  }
  return $max;
}