diff --git a/index.php b/index.php index 62fbdbf..9468aac 100644 --- a/index.php +++ b/index.php @@ -114,6 +114,12 @@ } // Validate and move the uploaded image file, if necessary + if($img['error'] != UPLOAD_ERR_OK && $img['error'] != UPLOAD_ERR_NO_FILE) { + if(!empty($img['tmp_name'])) + @unlink($img['tmp_name']); + return 'Invalid image, error ' . $img['error']; + } + if(!empty($img['tmp_name'])) { if((($img['type'] == 'image/gif') || ($img['type'] == 'image/jpeg') || ($img['type'] == 'image/pjpeg') || ($img['type'] == 'image/png') || ($img['type'] == 'image/bmp'))