This question has been asked before, but not with this exact issue.
I have an upload system that works great (I’m uploading CSV and parsing them).
However, if a file size is over 5Mb it gives me the error:
you did not select a file to upload
If it is under, the file uploads and parses just fine.
I’ve set my php.ini setting first to 128M and just now to 99999999999999999999
I’ve also set my CI config maz_size to 9999999999
(I was using more realistic numbers, but I wanted to be sure)
I’ve restarted apache with each ini change but still ths problem remains.
I’ve seen that the error:
you did not select a file to upload
is shown when there’s a file size issue but I don’t know where else to check this.
Finally, if I echo phpinfo(), I can confirm that max upload is 999999999999999
Pulling my hair out…
What else could it be?
/// update: code addition
I’ve got two methods of parsing the csv, either line by line or dumping the whole file direct into the DB and sort it out later. both of these work, and are selected by a config setting. that’s what the line: $this->config->item(‘import_type’) is for. Any ideas are welcome!
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.' ));
}
}
}
You have to increase post_max_size on php.ini too
http://www.php.net/manual/en/ini.core.php#ini.post-max-size