public function getMaxUploadSize()
    {
        if (!isset($this->maxUploadSize)) {
            $size = Ini::getBytes('post_max_size');

            $uploadMax = Ini::getBytes('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 *= 0.995;
            }

            $this->maxUploadSize = $size;
        }

        return $this->maxUploadSize;
    }