aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_upload.php39
-rw-r--r--phpBB/language/en/common.php4
-rw-r--r--phpBB/language/en/posting.php2
3 files changed, 40 insertions, 5 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index e3a9363d62..1ad6223aa1 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -594,7 +594,18 @@ class fileupload
// PHP Upload filesize exceeded
if ($file->get('filename') == 'none')
{
- $file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+ $max_filesize = @ini_get('upload_max_filesize');
+ $unit = 'MB';
+
+ if (!empty($max_filesize))
+ {
+ $unit = strtolower(substr($max_filesize, -1, 1));
+ $max_filesize = (int) $max_filesize;
+
+ $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+ }
+
+ $file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
return $file;
}
@@ -670,7 +681,18 @@ class fileupload
// PHP Upload filesize exceeded
if ($file->get('filename') == 'none')
{
- $file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+ $max_filesize = @ini_get('upload_max_filesize');
+ $unit = 'MB';
+
+ if (!empty($max_filesize))
+ {
+ $unit = strtolower(substr($max_filesize, -1, 1));
+ $max_filesize = (int) $max_filesize;
+
+ $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+ }
+
+ $file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
return $file;
}
@@ -818,7 +840,18 @@ class fileupload
switch ($errorcode)
{
case 1:
- $error = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
+ $max_filesize = @ini_get('upload_max_filesize');
+ $unit = 'MB';
+
+ if (!empty($max_filesize))
+ {
+ $unit = strtolower(substr($max_filesize, -1, 1));
+ $max_filesize = (int) $max_filesize;
+
+ $unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
+ }
+
+ $error = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
break;
case 2:
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index f603506b40..12510d5d5e 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -87,7 +87,7 @@ $lang = array_merge($lang, array(
'AVATAR_NO_SIZE' => 'The width or height of the linked avatar could not be determined. Please enter them manually.',
'AVATAR_PARTIAL_UPLOAD' => 'The specified file was only partially uploaded.',
'AVATAR_PHP_SIZE_NA' => 'The avatar’s filesize is too large.<br />The maximum allowed filesize set in php.ini could not be determined.',
- 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %d MB.<br />Please note this is set in php.ini and cannot be overridden.',
+ 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.',
'AVATAR_URL_INVALID' => 'The URL you specified is invalid.',
'AVATAR_URL_NOT_FOUND' => 'The file specified could not be found.',
'AVATAR_WRONG_FILESIZE' => 'The avatar’s filesize must be between 0 and %1d %2s.',
@@ -228,6 +228,8 @@ $lang = array_merge($lang, array(
'FTP_USERNAME_EXPLAIN' => 'Username used to connect to your server.',
'GENERAL_ERROR' => 'General Error',
+ 'GB' => 'GB',
+ 'GIB' => 'GiB',
'GO' => 'Go',
'GOTO_PAGE' => 'Go to page',
'GROUP' => 'Group',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index f75837e96f..b3acb7f290 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -141,7 +141,7 @@ $lang = array_merge($lang, array(
'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded.',
'PHP_SIZE_NA' => 'The attachment’s file size is too large.<br />Could not determine the maximum size defined by PHP in php.ini.',
- 'PHP_SIZE_OVERRUN' => 'The attachment’s file size is too large, the maximum upload size is %d MB.<br />Please note this is set in php.ini and cannot be overridden.',
+ 'PHP_SIZE_OVERRUN' => 'The attachment’s file size is too large, the maximum upload size is %1$d %2$s.<br />Please note this is set in php.ini and cannot be overridden.',
'PLACE_INLINE' => 'Place inline',
'POLL_DELETE' => 'Delete poll',
'POLL_FOR' => 'Run poll for',