您好我正在尝试在Codeigniter中上传.ini文件,但CI显示我不允许此文件类型的错误。
我试过把它放在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);
}
}
答案 0 :(得分:1)