svgedit/editor/extensions/fileopen.php

22 lines
551 B
PHP

<!doctype html>
<?php
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
$file = $_FILES['svg_file']['tmp_name'];
$output = file_get_contents($file);
$type = $_REQUEST['type'];
$prefix = '';
// Make Data URL prefix for import image
if($type == 'import_img') {
$info = getimagesize($file);
$prefix = 'data:' . $info['mime'] . ';base64,';
}
?>
<script>
window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo $type ?>");
</script>