Skip to content

Commit

Permalink
Fixed issue: Wrong minimum upload size determined
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Dec 7, 2017
1 parent 90948a2 commit 22aed0c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4888,15 +4888,20 @@ function humanFilesize($bytes, $decimals = 2)
}

/**
* @param string $sSize
* @return bool|int|string
*/
* This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
*
* @param string $sSize
* @return integer The value in bytes
*/
function convertPHPSizeToBytes($sSize)
{
//This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case)
$sSuffix = substr($sSize, -1);
//
$sSuffix = strtoupper(substr($sSize, -1));
if (!in_array($sSuffix,array('P','T','G','M','K'))){
return (int)$sSize;
}
$iValue = substr($sSize, 0, -1);
switch (strtoupper($sSuffix)) {
switch ($sSuffix) {
case 'P':
$iValue *= 1024;
// Fallthrough intended
Expand All @@ -4913,7 +4918,7 @@ function convertPHPSizeToBytes($sSize)
$iValue *= 1024;
break;
}
return $iValue;
return (int)$iValue;
}

function getMaximumFileUploadSize()
Expand Down

0 comments on commit 22aed0c

Please sign in to comment.