title: How to Pass input type "file" value onto Codeigniter Controller
body: <p>This may sounds simple, but I really got stuck on how to pass a value of  onto a Codeigniter controllers. I have a logic on my controller that If the value of input type file is empty, it will be processed on function A of my model, or else on function B of my model.</p>
  
  <p>Like this:</p>
  
  <pre><code>'if($newimage==''|$newimage==null){
      $this-&gt;mymodel-&gt;dofullpart();
   }
  else{
      $this-&gt;mymodel-&gt;dopart();
  '
  </code></pre>
  
  <p>I've tried to catch it on controller using: </p>
  
  <pre><code>'$newimage=$this-&gt;input-&gt;post('imagename');'
  </code></pre>
  
  <p>But I didn't get any value, although I printed it, there is nothing shown.
  Then I tried to catch it using:</p>
  
  <pre><code>'$newimage=$_FILES['imagename']['name'];' 
  </code></pre>
  
  <p>Yes, the value retrieved successfully when I did select any file, and not retrieved when I didn't select any.</p>
  
  <p>Another problem comes, everytime I edit other part of my form except selecting image, the $newimage always get value consists of two characters like = 'Ut' or 'Yt' which I suspect it was generated randomly by $_FILES. It makes my logic upthere not working.</p>
  
  <p>Is there any more safe way to get the value and catch it precisely whether it is not selected or selected?</p>
  
  <p>Thank you</p>