Skip to content

Commit

Permalink
CRM-20246: maxfilesize on import should respect 0 as meaning 'no limit'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jitendra Purohit authored and Jitendra Purohit committed Mar 20, 2017
1 parent e410674 commit 1ba7ecc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRM/Import/DataSource/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public function buildQuickForm(&$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);
$form->assign('uploadSize', $uploadSize);
$form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
Expand Down
5 changes: 5 additions & 0 deletions CRM/Import/Form/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public function buildQuickForm() {
$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);
Expand Down

0 comments on commit 1ba7ecc

Please sign in to comment.