title: Codeigniter Image upload ignore allowed types and file size
body: <p>I have below code to upload user image,  my code work good but I'm getting issue while checking <code>allowed_types</code> i.e. <code>png|jpg</code> and <code>max_size</code>..
  It doesn't check <strong>allowed type</strong> and <strong>max size</strong></p>
  
  <p>Code:</p>
  
  <pre><code>$this-&gt;load-&gt;library('upload');
  $config['upload_path'] = 'admin/upload/';
  $config['allowed_types'] = 'jpg|jpeg';
  $config['max_size'] = '100';
  
  $this-&gt;load-&gt;library('upload', $config);
  $this-&gt;upload-&gt;initialize($config);
  $this-&gt;upload-&gt;set_allowed_types('*');
  
  if (!$this-&gt;upload-&gt;do_upload('user_image')){ 
      $data = array('msg' =&gt; $this-&gt;upload-&gt;display_errors());
      $flag="1";
  }else { 
      $image_path = $this-&gt;upload-&gt;data();
      $flag="2";
  }
  </code></pre>
  
  <p>Output:</p>
  
  <p><code>$flag</code> always set to 2...even I uploaded file .png or .gif and same problem for <code>max_size</code></p>