2014-01-31 12:58:16 +00:00
< ? php
2018-05-18 06:41:43 +00:00
// You must first create a file "savefile_config.php" in this extensions directory and do whatever
// checking of user credentials, etc. that you wish; otherwise anyone will be able to post SVG
// files to your server which may cause disk space or possibly security problems
2014-01-31 12:58:16 +00:00
require ( 'savefile_config.php' );
if ( ! isset ( $_POST [ 'output_svg' ])) {
2018-05-30 23:52:13 +00:00
print 'You must supply output_svg' ;
2018-05-18 06:41:43 +00:00
exit ;
}
$svg = $_POST [ 'output_svg' ];
$filename = ( isset ( $_POST [ 'filename' ]) && ! empty ( $_POST [ 'filename' ]) ? preg_replace ( '@[\\\\/:*?"<>|]@u' , '_' , $_POST [ 'filename' ]) : 'saved' ) . '.svg' ; // These characters are indicated as prohibited by Windows
2014-02-01 16:42:46 +00:00
2018-05-18 06:41:43 +00:00
$fh = fopen ( $filename , 'w' ) or die ( " Can't open file " );
fwrite ( $fh , $svg );
fclose ( $fh );
2014-01-31 12:58:16 +00:00
?>