$this->revampPages = array();
$size = trim(ini_get('upload_max_filesize'));
+ if ($size) {
+ $this->maxImportFileSize = self::formatUnitSize($size);
+ }
+ }
+
+ /**
+ * Function to format size
+ *
+ * @access public
+ * @static
+ */
+
+ public static function formatUnitSize($size, $checkForPostMax = FALSE) {
if ($size) {
$last = strtolower($size{strlen($size) - 1});
switch ($last) {
case 'k':
$size *= 1024;
}
- $this->maxImportFileSize = $size;
+
+ if ($checkForPostMax) {
+ $config = CRM_Core_Config::singleton();
+ if($config->maxImportFileSize > $size) {
+ CRM_Core_Session::setStatus(ts("Note: Upload max filesize ('upload_max_filesize') should not exceed Post max size ('post_max_size') as defined in PHP.ini, please check with your system administrator."), ts("Warning"), "alert");
+ }
+ }
+ return $size;
}
}