From 43e650373b89d2fb7ce1d580dccc10ed46dd7fa7 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 5 Nov 2018 02:16:35 +0100 Subject: [PATCH] upload: describe size overflow errors Help diagnose some problems, particularly with low server settings. Unfortunately exceeding upload_max_filesize only causes empty files. --- upload.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/upload.inc.php b/upload.inc.php index f1018c2..c578a2d 100644 --- a/upload.inc.php +++ b/upload.inc.php @@ -4,6 +4,10 @@ function userupload($input, $target = NULL, $filename = NULL) switch ($input['error']) { case UPLOAD_ERR_OK: break; + case UPLOAD_ERR_INI_SIZE: + case UPLOAD_ERR_FORM_SIZE: + throw new Exception('bestand te groot'); + break; case UPLOAD_ERR_NO_FILE: return; # current default: @@ -24,7 +28,7 @@ function userupload($input, $target = NULL, $filename = NULL) } if (!@move_uploaded_file($input['tmp_name'], $target)) { - throw new Exception('bestand kon niet worden opgeslagen'); + throw new Exception("bestand kon niet worden opgeslagen in $target"); } foreach (@glob('thumb/*/') as $thumbres) { -- 2.30.0