Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 ;
- }
Add Comment
Please, Sign In to add comment