fileopen.php 722 B

12345678910111213141516171819202122232425262728293031
  1. <!doctype html>
  2. <?php
  3. /*
  4. * fileopen.php
  5. * To be used with ext-server_opensave.js for SVG-edit
  6. *
  7. * Licensed under the Apache License, Version 2
  8. *
  9. * Copyright(c) 2010 Alexis Deveria
  10. *
  11. */
  12. // Very minimal PHP file, all we do is Base64 encode the uploaded file and
  13. // return it to the editor
  14. $file = $_FILES['svg_file']['tmp_name'];
  15. $output = file_get_contents($file);
  16. $type = $_REQUEST['type'];
  17. $prefix = '';
  18. // Make Data URL prefix for import image
  19. if($type == 'import_img') {
  20. $info = getimagesize($file);
  21. $prefix = 'data:' . $info['mime'] . ';base64,';
  22. }
  23. ?>
  24. <script>
  25. window.top.window.svgEditor.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo $type ?>");
  26. </script>