input type file not working codeigniter : This is the controller. I update the image but I think input type file not accept file or not send the file to the controller so my code was not working well. I think controller code is true. 

Its urgent friends, please help me and this is my first question in StackOverflow.


class OurTeam extends CI_Controller {

public function UpdateTeam()
	{ 
		
		
		$config['image_library'] = 'gd2';
		$config['upload_path']   = '../employeephoto/';
		$config['source_image']  ='employeephoto/';
		$config['allowed_types']  = 'gif|jpg|png';
		$config['max_size']       = 12024; 
		$config['width']            = 300;
		$config['height']           = 150;
		
	    $this->load->library('upload', $config); 
		
		$img = $_FILES['fileupdate']['name'];
		if($img)
		{ 
		
			if (!$this->upload->do_upload('fileupdate'))
			{
				$error = array('error' => $this->upload->display_errors()); 
				
			}
			else
			{   
				$data = array('upload_data' => $this->upload->data());
				
				$file_name=($this->upload->data('file_name'));
				
				$this->load->model('OurTeamModel');
				
				$id= $_POST['id'];
				$removeimg = $this->OurTeamModel->SelectById($id);
				echo $imgpath = 'employeephoto/'.$removeimg[0]->img;
				if(file_exists($imgpath))
				{
				 	unlink($imgpath);
				 }
			   else
			   {
				   echo "no";
				} 
				  $this->OurTeamModel->UpdateOurTeam($file_name);
				  
				  
				   
				 
				
				
				$config['image_library'] = 'gd2';
				$config['upload_path']   = '../employeephoto/'.$file_name;
				$config['source_image']  = '../employeephoto/'.$file_name;
				$config['maintain_ratio'] = false;
				$config['allowed_types'] = 'gif|jpg|png';
				$config['width']         = 660;
				$config['height']        = 300; 
			
				$this->load->library('image_lib', $config);	
				$this->image_lib->clear();
				$this->image_lib->initialize($config);
				$ok = $this->image_lib->resize(); 
				 
			}
		
		}
		else
		{
			$this->load->model('OurTeamModel');
			$this->OurTeamModel->UpdateOurTeamRecord();  
		}
			
			redirect('admin/OurTeam');
	} 
}


This is view page 


    <?php echo form_open_multipart('admin/OurTeam/UpdateTeam');?>

     <input type="file" name="fileupdate" size="20"  id="fileupdate">
     <input type="submit" value="Save" >

    </form>





 