BenitoDannes

_uploadImage

Mar 10th, 2020
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. private function _uploadImage()
  2. {
  3.     $config['upload_path']          = './upload/product/';
  4.     $config['allowed_types']        = 'gif|jpg|png';
  5.     $config['file_name']            = $this->product_id;
  6.     $config['overwrite']            = true;
  7.     $config['max_size']             = 1024; // 1MB
  8.     // $config['max_width']            = 1024;
  9.     // $config['max_height']           = 768;
  10.  
  11.     $this->load->library('upload', $config);
  12.  
  13.     if ($this->upload->do_upload('image')) {
  14.         return $this->upload->data("file_name");
  15.     }
  16.    
  17.     return "default.jpg";
  18. }
Advertisement
Add Comment
Please, Sign In to add comment