Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106109659
fileopen.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 22, 13:05
Size
1 KB
Mime Type
text/html
Expires
Mon, Mar 24, 13:05 (2 d)
Engine
blob
Format
Raw Data
Handle
25108638
Attached To
rDESUTOPLATFORM Desuto Platform
fileopen.php
View Options
<!DOCTYPE html>
<?php
/*
* fileopen.php
* To be used with ext-server_opensave.js for SVG-edit
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
*
*/
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
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'
];
$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,'
;
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<script>
top.svgEditor.processFile("
<?php
// This should be safe since SVG edit does its own filtering (e.g., if an SVG file contains scripts)
echo
$prefix
.
base64_encode
(
$output
);
?>
", "
<?php
echo
$type
;
?>
");
</script>
</head><body></body>
</html>
Event Timeline
Log In to Comment