Guest User

Untitled

a guest
Jan 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public function uploadPhoto($photo){
  2. $this->load->model("misc_model");
  3.  
  4. //required vars
  5. $tmp_name = $photo["tmp_name"];
  6. $name = $photo["name"];
  7. $type = $photo["type"];
  8. $size = $photo["size"];
  9. $error_upload = $photo["error"];
  10.  
  11.  
  12. $random_str = $this->misc_model->generateRandomNumber(20, true, true);
  13.  
  14. $this->s3->putBucket($this->config->item("bucket"), S3::ACL_PUBLIC_READ);
  15.  
  16. if($this->s3->putObjectFile($tmp_name, $this->config->item("bucket") , 'photos/'.$random_str.".jpg", S3::ACL_PUBLIC_READ) ){
  17. echo 'ok';
  18. }else{
  19. echo 'fail';
  20. }
  21.  
  22. }
Add Comment
Please, Sign In to add comment