From: Mischa POSLAWSKY Date: Mon, 5 Nov 2018 01:16:35 +0000 (+0100) Subject: upload: describe size overflow errors X-Git-Tag: v3.8~1 X-Git-Url: http://git.shiar.net/minimedit.git/commitdiff_plain/43e650373b89d2fb7ce1d580dccc10ed46dd7fa7 upload: describe size overflow errors Help diagnose some problems, particularly with low server settings. Unfortunately exceeding upload_max_filesize only causes empty files. --- 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) {