title: codeigniter 3- You did not select a file to upload
body: <p>Post_plot.php (This is my view form)</p>
  
  <pre><code>&lt;form action="http://localhost:8080/ci/admin/plot/do_upload" enctype="multipart/form-data" method="post"&gt;
  
  &lt;input type="text" name="property_title" value=""  /&gt;
  
  &lt;input type="file" name="img" id="plot-img" value=""  /&gt;
  
  &lt;input type="submit" name="submit" value="Submit" /&gt;
  
  &lt;/form&gt; 
  </code></pre>
  
  <p>I have a long form with an image upload option.</p>
  
  <p>I am using do_upload function to upload file</p>
  
  <p>I am getting following error</p>
  
  <pre><code>Array ( [name] =&gt; a.jpg [type] =&gt; image/jpeg [tmp_name] =&gt; C:\xampp\tmp\phpBD75.tmp [error] =&gt; 0 [size] =&gt; 132277 ) Array ( [error] =&gt;
  You did not select a file to upload.
  
  )
  </code></pre>
  
  <p>Plot.php Controller</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Plot extends CI_Controller {
  
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;library('Admin_layout');
          $this-&gt;load-&gt;model('admin/plot_model');
          $this-&gt;config-&gt;load('plot_rules');
          $this-&gt;output-&gt;enable_profiler(TRUE);
      }
  
  
      public function do_upload()
      {
              $config['upload_path']          = '../images/';
              $config['allowed_types']        = 'gif|jpg|png';
              $config['max_size']             = 100;
              $config['max_width']            = 1024;
              $config['max_height']           = 768;
  
              $this-&gt;load-&gt;library('upload', $config);
  
              if ( ! $this-&gt;upload-&gt;do_upload($img))
              {
                      $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
                      print_r($error);
              }
              else
              {
                      $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
                      //$this-&gt;load-&gt;view('upload_success', $data);
                      print_r($data);
              }
      }//do_upload
  
  
  }//class
  </code></pre>
  
  <p>Should i pass any parameters in do_upload function?</p>