title: Codeigniter Modular HMVC extension - cant upload file
body: <p>I have a problem with uploading files by form. Everytime I try, I get the error "File type not allowed". I am using HMVC modular extension and my controllers extends MX_Controller.</p>
  
  <p>I already tried to $var_dump($_FILES) from my form-view and the result is fine, but when I try to use method do_upload() in controller it doesnt work. </p>
  
  <p>Does anyone have any idea? Here is the controller:</p>
  
  <pre><code>Class Store_data extends MX_Controller
  </code></pre>
  
  <p>{</p>
  
  <pre><code>function __construct()
  {
      parent::__construct();
  }
  
  function upload_pic()
  {
      //$data['item_id'] = $item_id;
      $template = "bootstrap_theme";
      //$current_url = current_url();
      //$data['form_location'] = $current_url;
      $data['view_file'] = "upload_pic";
      $this-&gt;load-&gt;module('template');
      $this-&gt;template-&gt;$template($data);
  }
  
  function do_upload()
  {
      //var_dump($_FILES);
      $config['upload_path'] = './images/';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size'] = '10000';
      $config['max_width']  = '4024';
      $config['max_height']  = '4768';
      $this-&gt;load-&gt;library('upload', $config);
      $this-&gt;upload-&gt;overwrite = true;
      $this-&gt;upload-&gt;initialize($config);
  
      if ( ! $this-&gt;upload-&gt;do_upload())
      {
          $data['error'] = $this-&gt;upload-&gt;display_errors();
          $template = "bootstrap_theme";
  
          $data['view_file'] = "upload_pic";
          $this-&gt;load-&gt;module('template');
          $this-&gt;template-&gt;$template($data);
      }
      else
      {
          $data['upload_data'] = $this-&gt;upload-&gt;data();
          $template = "bootstrap_theme";
          $data['view_file'] = "upload_success";
          $this-&gt;load-&gt;module('template');
          $this-&gt;template-&gt;$template($data);
      }
  }
  </code></pre>
  
  <p>And here is the upload form view:</p>
  
  <pre><code>&lt;?php echo $error;?&gt;
  &lt;?php echo form_open_multipart('store_data/do_upload');?&gt;
  &lt;input type="file" name="userfile" size="20" /&gt;
  &lt;br /&gt;&lt;br /&gt;
  &lt;input type="submit" value="upload" /&gt;
  &lt;/form&gt;
  </code></pre>