Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('UPLOAD_DIR', 'images/');
- $image = 'base64stringhere';
- $image = str_replace('data:image/png;base64,', '', $image);
- $image = str_replace(' ', '+', $image);
- $data = base64_decode($image);
- $file = UPLOAD_DIR . uniqid() . '.png';
- $success = file_put_contents($file, $data);
- print $success ? $file : 'error';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement