Skip to content

Instantly share code, notes, and snippets.

@Peelz
Last active July 17, 2018 09:13
Show Gist options
  • Save Peelz/9a773c11e318a4ada5ec4f3b3d97f3ba to your computer and use it in GitHub Desktop.
Save Peelz/9a773c11e318a4ada5ec4f3b3d97f3ba to your computer and use it in GitHub Desktop.
base 64 to blob storage
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