Some error reporting in fileopen.php
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2888 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
6bffe68d65
commit
e8a15a5582
|
@ -12,10 +12,16 @@
|
||||||
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
|
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
|
||||||
// return it to the editor
|
// return it to the editor
|
||||||
|
|
||||||
$type = $_REQUEST['type'];
|
if (!isset($_REQUEST['type'])) {
|
||||||
if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) {
|
echo "No type given";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
$type = $_REQUEST['type'];
|
||||||
|
if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) {
|
||||||
|
echo "Not a recognized type";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
require('allowedMimeTypes.php');
|
require('allowedMimeTypes.php');
|
||||||
|
|
||||||
$file = $_FILES['svg_file']['tmp_name'];
|
$file = $_FILES['svg_file']['tmp_name'];
|
||||||
|
@ -28,6 +34,7 @@
|
||||||
if ($type == 'import_img') {
|
if ($type == 'import_img') {
|
||||||
$info = getimagesize($file);
|
$info = getimagesize($file);
|
||||||
if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) {
|
if (!in_array($info['mime'], $allowedMimeTypesBySuffix)) {
|
||||||
|
echo "Disallowed MIME for supplied file";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$prefix = 'data:' . $info['mime'] . ';base64,';
|
$prefix = 'data:' . $info['mime'] . ';base64,';
|
||||||
|
|
Loading…
Reference in New Issue