此问题之前已被询问过,但没有涉及到这个问题。 我有一个很好的上传系统(我上传CSV并解析它们)。 但是,如果文件大小超过5Mb它给我的错误: 你没有选择一个文件上传CodeIgniter上传文件错误:您没有选择要上传的文件
如果它在下,文件上传和解析就好了。
我设置我的php.ini先128M,只是现在99999999999999999999 我也把我的CI配置maz_size到9999999999 设置(我用的是更现实的数字,但我想是肯定) 我已经重启了每个ini更改的apache,但仍然存在问题。
我已经看到错误: 您没有选择要上传的文件 会在出现文件大小问题时显示,但我不知道要在何处检查此问题。
最后,如果我赞同的phpinfo(),我可以证实,最大上传为999999999999999
拉我的头发...
还有什么可能呢?
///更新:代码添加 我有两种方法来逐行解析csv,或者将整个文件直接转储到数据库中,然后再进行排序。这两个工作,并通过配置设置进行选择。这是行:$ this-> config-> item('import_type')的用途。任何想法都欢迎!
public function upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'txt|csv|xls|xlsx';
$config['max_size'] = '999999999999999999999';
$this->load->library('upload', $config);
if (! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('feed_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
if ($this->config->item('import_type') == 'db') {
$result = $this->model_feed->capture_file($this->input->post('feed_name'), $data['upload_data']['full_path']);
} else {
$result = $this->capture_feeds($this->input->post('feed_name'), $data['upload_data']['full_path']);
}
if ($result) {
$this->load->view('feed_upload_success', $data);
} else {
$this->load->view('feed_form', array('error' => 'The file you supplied does not match the data structure we were expecting.'));
}
}
}
这个函数你是否将表单设置为multipart? – 2012-07-05 13:40:14
你能粘贴你的代码吗?也许有一个错字或错误 – Sangar82 2012-07-05 13:52:26