在CI中上传.ini文件 [英] uploading .ini files in CI
问题描述
尝试上传.ini文件时出现以下错误
I get following error when trying to upload .ini files
不允许您尝试上传的文件类型。
"The filetype you are attempting to upload is not allowed."
以下是用于上传文件的功能
Below is the function for uploading files
private function _upload_config_file() {
$config['upload_path'] = APPPATH . 'config/ini/';
$config['allowed_types'] = 'ini';
$config['max_size'] = '2000000';
$this->load->library('upload', $config);
if ($this->upload->do_upload()) {
$this->upload_status = 'File uploaded succesfully !';
return true;
} else {
$this->upload_status = $this->upload->display_errors();
return false;
}
}
视野中
$upload_file_attr = array(
'name' => 'userfile',
'id' => 'userfile',
'disabled' => 'disabled'
);
echo form_open_multipart('sys_setting', $form_sys_setting_multi);
echo form_label('Configure Manually' . form_checkbox($upload_checkbox, '', FALSE, $js_checkbox));
echo form_button($download_button);
echo form_upload($upload_file_attr);
echo form_reset($upload_reset);
echo form_submit($upload_submit);
echo form_close();
是否需要对php.ini进行任何更改以上传.ini文件?
Is there any changes to be made in php.ini for uploading .ini files ?
还是codeigniter的上传库不允许上传.ini文件?
Or Is it codeigniter's upload library that doesn't allow to upload .ini files ?
需要解决此问题的建议。
Need suggestions to solve this issue.
推荐答案
我解决了这个问题。在config / mimes.php中修改了$ mimes数组
I got this issue solved.In config/mimes.php modified $mimes array
$mimes = array('ini' => 'application/octet-stream')
如果有人知道如何在不修改核心文件的情况下解决此问题,* 请发表评论。 *
If any one knows how to solve this issue without modifying the core files, *Please do comment.*
这篇关于在CI中上传.ini文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!