0
嗨我試圖在Codeigniter中上傳.ini文件,但CI顯示我錯誤,該文件類型是不允許的。如何在codeigniter中上傳.ini文件?
我試圖把這個在mimes.php但沒有工作:
$mimes = array('ini' => 'application/octet-stream')
我的代碼是:
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);
}
}
這將幫助你http://stackoverflow.com/questions/19946892/uploading-ini-files-in-ci – Gopalakrishnan
我想,已經@Gopal但它不工作 – Rajan