/** * * @param bool|int $formated * @return int|string */ public static function getMaxUploadSize($formated = 0) { static $size; if (isset($size)) { return $formated ? MFile::bytesToFormat($size) : $size; } $maxUpload = MFile::toBytes(ini_get("upload_max_filesize")); $postMax = MFile::toBytes(ini_get("post_max_size")); $realMaxUpload = $postMax < $maxUpload ? $postMax : $maxUpload; //Apply the final value to the static variable $size = $realMaxUpload; return $formated ? MFile::bytesToFormat($size) : $size; }