From 7a7f68455296f52f34125525d9bfbad5e0fab0cd Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sun, 16 Aug 2026 16:03:20 +0200 Subject: [PATCH] Show error when PHP rejects oversized POST uploads --- admin.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/admin.php b/admin.php index ff9f377..7adaa24 100644 --- a/admin.php +++ b/admin.php @@ -12,6 +12,21 @@ $tools = bratonien_tools_get_tools(); $messages = array(); $errors = array(); +// If post_max_size is exceeded, PHP discards both $_POST and $_FILES before +// the plugin can inspect the upload. Detect that situation explicitly so the +// admin page does not silently reload without feedback. +if ( + $_SERVER['REQUEST_METHOD'] === 'POST' + && empty($_POST) + && empty($_FILES) + && !empty($_SERVER['CONTENT_LENGTH']) +) +{ + $errors[] = 'Upload abgelehnt: Die Anfrage ist groesser als das PHP-Limit post_max_size (' + .ini_get('post_max_size').'). Das Datei-Limit upload_max_filesize liegt bei ' + .ini_get('upload_max_filesize').'.'; +} + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['bratonien_tool'])) { check_pwg_token();