From e8a15a55820082f4df1e180623c0ce30c5d81483 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Fri, 13 Jun 2014 15:38:20 +0000 Subject: [PATCH] Some error reporting in fileopen.php git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2888 eee81c28-f429-11dd-99c0-75d572ba1ddd --- editor/extensions/fileopen.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/editor/extensions/fileopen.php b/editor/extensions/fileopen.php index f0ae937b..d2edbbbe 100644 --- a/editor/extensions/fileopen.php +++ b/editor/extensions/fileopen.php @@ -12,10 +12,16 @@ // Very minimal PHP file, all we do is Base64 encode the uploaded file and // return it to the editor - $type = $_REQUEST['type']; - if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) { + if (!isset($_REQUEST['type'])) { + echo "No type given"; exit; } + $type = $_REQUEST['type']; + if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) { + echo "Not a recognized type"; + exit; + } + require('allowedMimeTypes.php'); $file = $_FILES['svg_file']['tmp_name']; @@ -23,11 +29,12 @@ $output = file_get_contents($file); $prefix = ''; - + // Make Data URL prefix for import image if ($type == 'import_img') { $info = getimagesize($file); if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) { + echo "Disallowed MIME for supplied file"; exit; } $prefix = 'data:' . $info['mime'] . ';base64,';