Guest User

Untitled

a guest
Jul 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public function base64Storage($input, $destination, $rename = "")
  2. {
  3. list($type, $data) = explode(';', $input);
  4. list(, $data) = explode(',', $data);
  5. $data = base64_decode($data);
  6.  
  7. $file_name = sha1(time()) ;
  8. $extention = explode('/', $type)[1] ;
  9. $full_file_name = $file_name.'.'.$extention ;
  10.  
  11. $full_path = $destination.$full_file_name;
  12. file_put_contents($full_path, $data);
  13.  
  14. return $full_path ;
  15. }
Add Comment
Please, Sign In to add comment