From: Michael M Slusarz Date: Thu, 11 Feb 2010 19:14:36 +0000 (-0700) Subject: Check that the file exists and has contents when uploading X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a2049e474e116617892de09a0a8fd857f53a4f27;p=horde.git Check that the file exists and has contents when uploading --- diff --git a/framework/Browser/lib/Horde/Browser.php b/framework/Browser/lib/Horde/Browser.php index f0b1c633c..21b73d168 100644 --- a/framework/Browser/lib/Horde/Browser.php +++ b/framework/Browser/lib/Horde/Browser.php @@ -1072,7 +1072,10 @@ class Horde_Browser if (!isset($_FILES) || ($error == UPLOAD_ERR_NO_FILE)) { throw new Horde_Browser_Exception(sprintf('There was a problem with the file upload: No %s was uploaded.', $name), UPLOAD_ERR_NO_FILE); } elseif (($error == UPLOAD_ERR_OK) && is_uploaded_file($tmp_name)) { - return; + if (!filesize($tmp_name)) { + throw new Horde_Browser_Exception('The uploaded file appears to be empty. It may not exist on your computer.', UPLOAD_ERR_NO_FILE); + } + // SUCCESS } elseif (($error == UPLOAD_ERR_INI_SIZE) || ($error == UPLOAD_ERR_FORM_SIZE)) { throw new Horde_Browser_Exception(sprintf('There was a problem with the file upload: The %s was larger than the maximum allowed size (%d bytes).', $name, min($uploadSize, Horde_Util::getFormData('MAX_FILE_SIZE'))), $error);