From: Jitendra Purohit Date: Mon, 20 Mar 2017 10:07:55 +0000 (+0530) Subject: CRM-20246: maxfilesize on import should respect 0 as meaning 'no limit' X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ebcf0a880d9240ef0dffe9c38323f68242a2687d;p=civicrm-core.git CRM-20246: maxfilesize on import should respect 0 as meaning 'no limit' --- diff --git a/CRM/Import/DataSource/CSV.php b/CRM/Import/DataSource/CSV.php index 37d5ae1ab9..c11b0aeb6a 100644 --- a/CRM/Import/DataSource/CSV.php +++ b/CRM/Import/DataSource/CSV.php @@ -66,6 +66,10 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource { $config = CRM_Core_Config::singleton(); $uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE); + //Fetch uploadFileSize from php_ini when $config->maxFileSize is set to "no limit". + if (empty($uploadFileSize)) { + $uploadFileSize = CRM_Utils_Number::formatUnitSize(ini_get('upload_max_filesize'), TRUE); + } $uploadSize = round(($uploadFileSize / (1024 * 1024)), 2); $form->assign('uploadSize', $uploadSize); $form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE); diff --git a/CRM/Import/Form/DataSource.php b/CRM/Import/Form/DataSource.php index 7303052778..2270e6b748 100644 --- a/CRM/Import/Form/DataSource.php +++ b/CRM/Import/Form/DataSource.php @@ -57,6 +57,11 @@ abstract class CRM_Import_Form_DataSource extends CRM_Core_Form { $config = CRM_Core_Config::singleton(); $uploadFileSize = CRM_Utils_Number::formatUnitSize($config->maxFileSize . 'm', TRUE); + + //Fetch uploadFileSize from php_ini when $config->maxFileSize is set to "no limit". + if (empty($uploadFileSize)) { + $uploadFileSize = CRM_Utils_Number::formatUnitSize(ini_get('upload_max_filesize'), TRUE); + } $uploadSize = round(($uploadFileSize / (1024 * 1024)), 2); $this->assign('uploadSize', $uploadSize);