public function getMaxUploadSize()
{
if (!isset($this->maxUploadSize)) {
$size = Lib::filesizeToBytes(ini_get('post_max_size'));
$uploadMax = Lib::filesizeToBytes(ini_get('upload_max_filesize'));
if ($uploadMax > 0 && $uploadMax < $size) {
$size = $uploadMax;
} else {
// This reduces the reported max size by a small amount to take account of the difference between
// the uploaded file size and the size of the eventual post including other data.
$size = $size * 0.995;
}
$this->maxUploadSize = $size;
}
return $this->maxUploadSize;
}