Advertisement
freddy0512

upload

Oct 27th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. if (!empty($_FILES)) {
  2.  
  3. $config['upload_path'] = './uploads/product/';
  4. $config['allowed_types'] = 'gif|jpg|png';
  5. $config['overwrite'] = FALSE;
  6. $config['max_size'] = '500000';
  7. $this->upload->initialize($config);
  8.  
  9. if ($this->upload->do_upload('file')) {
  10. //here i want resize first before insert it ? alredy use here but cannot resize it
  11. /*
  12.  
  13. $config['image_library'] = 'gd2';
  14. $config['source_image'] = $this->upload->upload_path.$this->upload->file_name;
  15. $config['create_thumb'] = TRUE;
  16. $config['maintain_ratio'] = TRUE;
  17. $config['width'] = 75;
  18. $config['height'] = 50;
  19.  
  20. $this->load->library('image_lib', $config);
  21.  
  22. $this->image_lib->resize();
  23. */
  24.  
  25.  
  26.  
  27.  
  28.  
  29. $upload_data = $this->upload->data();
  30. $fileName = $upload_data['file_name'];
  31. $data=array('foto'=>$fileName,
  32. 'id_product_post'=>$this->input->post('id_product_post'),
  33. );
  34. $this->model_front->addfoto($data);
  35.  
  36. }
  37.  
  38.  
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement