Q:

How do i upload .ini file in codeigniter?

Hi I am trying to upload .ini file in Codeigniter but CI shows me error that this file type is not allowed.
I tried putting this in mimes.php but didn't work :
  $mimes = array('ini' => 'application/octet-stream')

My code is:
public function index()
{

$this->load->view('customer/upload/upload_ini', array('error' => ' ' ));
}

function do_upload()
{
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'ini';

    $this->load->library('upload', $config);
    $this->upload->initialize($config);

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());

        $this->load->view('customer/upload/upload_ini', $error);
    }
    else
    {
        $data = array('upload_data' => $this->upload->data());

        $this->load->view('customer/upload/upload_success', $data);
    }
}

A:

This solution may work for you but it will
upload all filetypes without any extension check,
$config['allowed_types'] = '*';

May this link will be useful to you. 
Hope it will help you :)

