diff --git a/inc/media.php b/inc/media.php index d8ca288c11321e4cef0ddacf2975c96cf50d21ce..3850f4e333272a478bacedf7e71fe625bbd8d306 100644 --- a/inc/media.php +++ b/inc/media.php @@ -239,11 +239,8 @@ function media_upload($ns,$auth){ $file = $_FILES['upload']; if(empty($id)) $id = $file['name']; - // check for data - if(!@filesize($file['tmp_name'])){ - msg('No data uploaded. Disk full?',-1); - return false; - } + // check for errors (messages are done in lib/exe/mediamanager.php) + if($file['error']) return false; // check extensions list($fext,$fmime,$dl) = mimetype($file['name']); diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index 7ad2f326c351090e3d32b0700456288a0dd93f56..471bd28ea633a94c214fc7226c3b55a6fc51a9f6 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -54,14 +54,17 @@ } // give info on PHP catched upload errors - if($_FILES['upload']['error']) switch($_FILES['upload']['error']){ - case 1: - case 2: - msg(sprintf($lang['uploadsize'], - filesize_h(php_to_byte(ini_get('upload_max_filesize')))),-1); - break; - default: - msg($lang['uploadfail'],-1); + if($_FILES['upload']['error']){ + switch($_FILES['upload']['error']){ + case 1: + case 2: + msg(sprintf($lang['uploadsize'], + filesize_h(php_to_byte(ini_get('upload_max_filesize')))),-1); + break; + default: + msg($lang['uploadfail'].' ('.$_FILES['upload']['error'].')',-1); + } + unset($_FILES['upload']); } // handle upload