title: You did not select a file to upload. PHP Code Igniter
body: <p>I am trying to implement a post functionality and want to pick message and image from a php view. My message functionality is working good. But on image upload i receive an error <code>You did not select a file to upload</code>. This is my controller function</p>
  
  <pre><code>function post_func()
  {
      session_start();
      echo $post_message=$_POST['post'];
      echo $share_with=$_POST['share_with'];
      echo $image=$_POST['image'];
      if($image==null){
          echo "&lt;br/&gt;no image&lt;br/&gt;";  
      }
      else{
          ////////////////////////////////////////////////////////////////////////////////////////
  
              $config['upload_path'] = './application/css';
              $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);
  
  
              $this-&gt;upload-&gt;initialize($config);
  
  
  
              if ( ! $this-&gt;upload-&gt;do_upload())
              {
                  $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
  
                  echo "&lt;br/&gt;";
                  echo $this-&gt;upload-&gt;display_errors();
                  echo "&lt;br/&gt; image error&lt;br/&gt;";
              }
              else
              {
  
                  echo "&lt;br/&gt; reached &lt;br/&gt;";
                  session_start();
                  $this-&gt;membership_model-&gt;insert_images($this-&gt;upload-&gt;data(),$email);
                  $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
  
                  echo "&lt;br/ problem&lt;br/&gt;";
              }
  
  
  
  
          ////////////////////////////////////////////////////////////////////////////////////////
      }
      $public;
      if($share_with=="public"){
          echo "1";
          $public=true;
      }else{
          echo "0";
          $public=false;
      }echo "-----------------------------&lt;br/&gt;";
      echo $user=$this-&gt;session-&gt;userdata('user_identification');
      $data = array 
              (
                  'userid'=&gt; $user,
                  'public' =&gt; $public,
                  'message' =&gt; $post_message,
                  'picname' =&gt; "None"
              );
      $this-&gt;load-&gt;model('membership_model');
      $this-&gt;membership_model-&gt;add_message($data);
      echo "&lt;/br&gt;";
      echo $user=$this-&gt;session-&gt;userdata('user_identification');
  }
  </code></pre>
  
  <p>This is my view.</p>
  
  <pre><code>&lt;?php echo form_open('search/post_func');?&gt;
  
  &lt;!--&lt;form id="loginForm" action="../search/post_func" method="post" enctype="multipart/form-data" &gt;--&gt;
  &lt;div id="your_post"&gt;
  &lt;div id="post_image"&gt;
  &lt;img   id ="post_img" src="&lt;?php  echo $this-&gt;config-&gt;item('base_url'); ?&gt;&lt;?php echo '/application/css/'. $img ?&gt;"/&gt;
  &lt;/div&gt;
  &lt;textarea name="post" rows="5" cols="30" placeholder="Share an update..." id="post_text" rows="2" value=""&gt;&lt;/textarea&gt;
  
  //other view items
              &lt;?php
      echo form_close();
      ?&gt; 
  </code></pre>
  
  <p>Please help me</p>