function UploadedFile::parseFilesize
1 call to UploadedFile::parseFilesize()
- UploadedFile::getMaxFilesize in vendor/
symfony/ http-foundation/ File/ UploadedFile.php - Returns the maximum size of an uploaded file as configured in php.ini.
File
-
vendor/
symfony/ http-foundation/ File/ UploadedFile.php, line 238
Class
- UploadedFile
- A file uploaded through a form.
Namespace
Symfony\Component\HttpFoundation\FileCode
private static function parseFilesize(string $size) : int|float {
if ('' === $size) {
return 0;
}
$size = strtolower($size);
$max = ltrim($size, '+');
if (str_starts_with($max, '0x')) {
$max = \intval($max, 16);
}
elseif (str_starts_with($max, '0')) {
$max = \intval($max, 8);
}
else {
$max = (int) $max;
}
switch (substr($size, -1)) {
case 't':
$max *= 1024;
// no break
case 'g':
$max *= 1024;
// no break
case 'm':
$max *= 1024;
// no break
case 'k':
$max *= 1024;
}
return $max;
}