Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 1.42 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. upload image problem at codeigniter
  2. //upload images
  3.         //some $config vars for image
  4.         $config['upload_path'] = './images/articles';
  5.         $config['allowed_types'] = 'gif|jpg|jpeg|png|mp3|wav';
  6.         $config['max_size'] = '0';
  7.         $config['remove_spaces'] = true;
  8.         $config['overwrite'] = false;
  9.         $config['max_width'] = '0';
  10.         $config['max_height'] = '0';
  11.  
  12.         $this->load->library('upload', $config);
  13.  
  14.         //upload main image
  15.         if(!$this->upload->do_upload('a_image')){
  16.             $e = $this->upload->display_errors();
  17.             //print_r($e);
  18.         }
  19.  
  20.         $image = $this->upload->data();
  21.         if($image['file_name']){
  22.             $data['a_image'] = "images/articles/". $image['file_name'];
  23.         }
  24.  
  25.         unset($config);
  26.  
  27.         //now upload thumb
  28.         //some $config vars for thumb
  29.         $config['upload_path'] = './images/articles/thumb';
  30.         $config['allowed_types'] = 'gif|jpg|jpeg|png|mp3|wav';
  31.         $config['max_size'] = '0';
  32.         $config['remove_spaces'] = true;
  33.         $config['overwrite'] = false;
  34.         $config['max_width'] = '0';
  35.         $config['max_height'] = '0';    
  36.         $this->load->library('upload', $config);
  37.  
  38.  
  39.         //upload thumbnail
  40.             if(!$this->upload->do_upload('a_thumbnail')){
  41.             $this->upload->dispaly_errors();    
  42.         }
  43.        
  44. $this->upload->initialize($config)
  45.        
  46. $this->load->library('upload', $config);