Last active
July 17, 2018 09:13
-
-
Save Peelz/9a773c11e318a4ada5ec4f3b3d97f3ba to your computer and use it in GitHub Desktop.
base 64 to blob storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function base64Storage($input, $destination, $rename = "") | |
{ | |
list($type, $data) = explode(';', $input); | |
list(, $data) = explode(',', $data); | |
$data = base64_decode($data); | |
$file_name = sha1(time()) ; | |
$extention = explode('/', $type)[1] ; | |
$full_file_name = $file_name.'.'.$extention ; | |
$full_path = $destination.$full_file_name; | |
file_put_contents($full_path, $data); | |
return $full_path ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment