⇦ Back to FilesystemHelper classMethod fileUploadMaxSize
public static float|string
fileUploadMaxSize
(mixed $unitOutput = true)
Calculates the maximum upload file size and returns string with unit or the size in bytes
Parameters
- bool $unitOutput This parameter determines whether the return value should be a string with a unit
Returns
- float|string The maximum upload size of files with the appropriate unit or in bytes
Since
Method fileUploadMaxSize - Source code
/**
* Calculates the maximum upload file size and returns string with unit or the size in bytes
*
* Call it with JFilesystemHelper::fileUploadMaxSize();
*
* @param bool $unitOutput This parameter determines whether the return value should be a string with a unit
*
* @return float|string The maximum upload size of files with the appropriate unit or in bytes
*
* @since 3.4
*/
public static function fileUploadMaxSize($unitOutput = true)
{
static $max_size = false;
static $output_type = true;
if ($max_size === false || $output_type != $unitOutput) {
$max_size = self::parseSize(ini_get('post_max_size'));
$upload_max = self::parseSize(ini_get('upload_max_filesize'));
if ($upload_max > 0 && ($upload_max < $max_size || $max_size == 0)) {
$max_size = $upload_max;
}
if ($unitOutput == true) {
$max_size = self::parseSizeUnit($max_size);
}
$output_type = $unitOutput;
}
return $max_size;
}