CRM-20246: maxfilesize on import should respect 0 as meaning 'no limit'
authorJitendra Purohit <jitendra@fuzion.co.nz>
Mon, 20 Mar 2017 10:07:55 +0000 (15:37 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Mon, 20 Mar 2017 10:07:55 +0000 (15:37 +0530)
CRM/Import/DataSource/CSV.php
CRM/Import/Form/DataSource.php

index 37d5ae1ab9589cee83fe88dea2dc6e055a854ef7..c11b0aeb6a6ae94ea33b256acb6f93e78ab9e6fc 100644 (file)
@@ -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);
index 7303052778ccdc1fa117d33a495cb85f590c7ad6..2270e6b74823df08d79b59fdd329f9ac7f41817a 100644 (file)
@@ -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);