From 05798f23d08214ccfaaa3d6f728c68e33bca3d8b Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sun, 16 Aug 2026 16:03:38 +0200 Subject: [PATCH] Improve upload limit error messages --- tools/asset_manager.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/asset_manager.inc.php b/tools/asset_manager.inc.php index 599bddc..a8c8118 100644 --- a/tools/asset_manager.inc.php +++ b/tools/asset_manager.inc.php @@ -96,6 +96,18 @@ function bratonien_tools_upload_asset() if (!isset($file['error']) || (int)$file['error'] !== UPLOAD_ERR_OK) { $code = isset($file['error']) ? (int)$file['error'] : -1; + if ($code === UPLOAD_ERR_INI_SIZE) + { + throw new RuntimeException('Upload abgelehnt: Die Datei ist groesser als das PHP-Limit upload_max_filesize ('.ini_get('upload_max_filesize').').'); + } + if ($code === UPLOAD_ERR_FORM_SIZE) + { + throw new RuntimeException('Upload abgelehnt: Die Datei ueberschreitet das erlaubte Upload-Limit des Formulars.'); + } + if ($code === UPLOAD_ERR_PARTIAL) + { + throw new RuntimeException('Upload fehlgeschlagen: Die Datei wurde nur teilweise uebertragen.'); + } throw new RuntimeException('Upload fehlgeschlagen (PHP-Uploadcode '.$code.').'); }