title: How to upload php or html file in codeigniter?
body: <p>How to upload php or html file in codeigniter using upload library? I have controller which working ok when uploading  jpg, gif, png files but it won't to upload files with php or html or sql extension.</p>
  
  <p>Here is my controller</p>
  
  <pre><code>public function ipload()
  {
   $this-&gt;load-&gt;helper('url');
   $this-&gt;load-&gt;model('m_company');
  
   $config['upload_path']          = './uploads/';
   $config['allowed_types']        = 'php|html|txt';
   $config['max_size']             = 2048;
   $config['max_width']             = 0;
   $config['max_height']             = 0;
  
   $this-&gt;load-&gt;library('upload', $config);
  
   if (!$this-&gt;upload-&gt;do_upload('userfile'))
   {
     $data = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
   }
   else
   {
     $this-&gt;upload-&gt;do_upload('userfile');
     $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
     $filen = $this-&gt;upload-&gt;data('file_name');
     $this-&gt;m_company-&gt;set_doc($filen);
   }
  echo json_encode($data);
   }
  </code></pre>
  
  <p>When allowed files are jpg gif png everything works fine</p>