Skip to content

Commit

Permalink
Create a.php
Browse files Browse the repository at this point in the history
  • Loading branch information
cornfields74 authored Jan 20, 2024
0 parents commit 33efead
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions a.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
// requires php5
define('UPLOAD_DIR', 'images/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
?>

0 comments on commit 33efead

Please sign in to comment.