Index: language/en/posting.php
===================================================================
--- language/en/posting.php (revision 293)
+++ language/en/posting.php (working copy)
@@ -142,6 +142,8 @@
'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded.',
'PHP_SIZE_NA' => 'The attachment’s file size is too large.
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 %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.',
+ 'PHP_POST_NA' => 'Nothing was submitted. If you tried uploading an attachment, it was too large and prevented the rest of the form from being processed. Please use the "Back" button in your browser to return to the previous page and try uploading a smaller attachment.
Could not determine the maximum size defined by PHP in php.ini.
If you are an administrator, please note that you must set memory_limit, post_max_size and upload_max_filesize to sufficiently large values to allow large file uploads.',
+ 'PHP_POST_OVERRUN' => 'Nothing was submitted. If you tried uploading an attachment, it was too large and prevented the rest of the form from being processed. Please use the "Back" button in your browser to return to the previous page and try uploading a smaller attachment.
The maximum upload size is %1$d %2$s. Please note this is set in php.ini and cannot be overridden.
If you are an administrator, please note that you must set memory_limit, post_max_size and upload_max_filesize to sufficiently large values to allow large file uploads.',
'PLACE_INLINE' => 'Place inline',
'POLL_DELETE' => 'Delete poll',
'POLL_FOR' => 'Run poll for',
Index: posting.php
===================================================================
--- posting.php (revision 293)
+++ posting.php (working copy)
@@ -642,7 +642,32 @@
load_drafts($topic_id, $forum_id);
}
+// Check for post submissions exceeding post_max_size.
+// In such event php clears $_POST and $_FILES.
+// Clearing of $_POST is unfortunate as typically user uploads a huge attachment and without it,
+// remainder of submission would fit in $_POST just fine.
+// Inform users that their submission did not make it.
+// See http://php.net/manual/en/ini.core.php#ini.post-max-size for documentation
+// and http://www.phpbb.com/bugs/phpbb3/58405 for discussion
+if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST))
+{
+ $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['PHP_POST_NA'] : sprintf($user->lang['PHP_POST_OVERRUN'], $max_filesize, $user->lang[$unit]);
+
+ // This will close upload progress popup
+ $_POST['add_file'] = true;
+}
+
if ($submit || $preview || $refresh)
{
$post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0);