The function getMaxSize located in COMPONENT\classes\file\upload.php, doesn't consider the server variable upload_max_filesize.
Sometimes the component config variable "upload_maxsize" is bigger than the previous server variable, so it happens to give a wrong info to the user at the upload process. I think the server variable upload_max_filesize should be considered as well, so here my hack to do it:
public static function getMaxSize($string = false, $maxSizeCustom = null)
{
$config = JComponentHelper::getParams( 'com_component' );
$maxSize = (int)$config->get('upload_maxsize') * 1024 * 1024;
$phpMaxSize = intval(ini_get('upload_max_filesize')) * 1024 * 1024; /* hack */
if (!$maxSize)
$maxSize =COMPONENT_UPLOAD_DEFAULT_MAX_SIZE;
if ($maxSizeCustom)
$maxSize = min($maxSize, $maxSizeCustom);
$maxSize = min($maxSize, $phpMaxSize); /* hack */
if ($string)
$maxSize = JText::sprintf("COMPONENT_UPLOAD_MAX_B", self::bytesToString($maxSize));
return $maxSize;
}
this also solve an unexpected script exit with no warning, I encountered during the upload of big files not allowed by the server.