mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 12:54:31 +00:00
Show error when PHP rejects oversized POST uploads
This commit is contained in:
15
admin.php
15
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();
|
||||
|
||||
Reference in New Issue
Block a user