xyc
2024-05-17 6b24f642b01cf3cd1be0d5833273fa2867d389e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!doctype html>
<?php
/*
 * fileopen.php
 * To be used with ext-server_opensave.js for SVG-edit
 *
 * Licensed under the Apache License, Version 2
 *
 * Copyright(c) 2010 Alexis Deveria
 *
 */
  // 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.methodDraw.processFile("<?php echo $prefix . base64_encode($output); ?>", "<?php echo htmlentities($type); ?>");
</script>