From 9676dc23466e3c707ecbf594aaa4dc89bfecafd2 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <andi@splitbrain.org> Date: Tue, 15 Jul 2008 23:53:45 +0200 Subject: [PATCH] Check file size of uploaded data This will abort the upload process when the uploaded temp file has zero bytes. This can occur when the disk is full. darcs-hash:20080715215345-7ad00-1a2b45b77d59b1b39d0133ec1737dbb0054368c1.gz --- inc/media.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/media.php b/inc/media.php index aa29c0d7d..e8a19caf9 100644 --- a/inc/media.php +++ b/inc/media.php @@ -215,6 +215,12 @@ 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 extensions list($fext,$fmime) = mimetype($file['name']); list($iext,$imime) = mimetype($id); -- GitLab