Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. $pic_file1 = $this->input->post('pic_file');
  2.  
  3. $pic_file1 = str_replace( "\", '/', $pic_file1);
  4. $filename = time().basename($pic_file1);
  5.  
  6.  
  7. $config['upload_path'] = './uploads/';
  8. $config['allowed_types'] = 'gif|jpg|png';
  9. $config['max_size'] = 1000;
  10. //$config['encrypt_name'] = TRUE;
  11. // $config['overwrite'] = FALSE;
  12. $config['file_name'] = $filename;
  13.  
  14. $this->load->library('upload', $config);
  15. $this->upload->initialize($config);
  16.  
  17. if ( ! $this->upload->do_upload('pic_file'))
  18. {
  19. $error = array('error' => $this->upload->display_errors());
  20. print_r($error);
  21. }
  22. else
  23. {
  24. $data = array('upload_data' => $this->upload->data());
  25. // print_r($data);
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement