Hi I have been building a website for about 3 months now and was today getting my girlfriend to fill it up with dummy content for testing purposes. There she was happily testing and uploading files when suddenly once she had done about 8 articles the uploader decided without any changes to code etc to start rejecting the upload saying the filetype is not allowed.
Now needless to say I have been uploading images through this for over a month and this is the first time this problem has arisen. What makes it even more confusing is that I am using the CI upload class in other sections with the same mime params and it works fine! I have checked the mime in $_FILES and this is image/jpg or image/png etc, all of which are recognised by CI. I have also seen about the bug in CI 2.1.0 but I am on 2.1.1 which I assume the bug was fixed for (or not) as the code within the upload lib where the error was before is slightly different.
Either way I deduce it is a mime error as setting the allowed types config param to * works fine! Of course this is no where near ideal as the potential security breaches are phenomenal. I am now reaching crunch time with this as I have other work to be getting on with. I have attached the portion of code that handles this upload incase I am doing something glaringly stupid but otherwise if anyone else has developed this problem out of nowhere I would love to know any work arounds/solutions...... Also any knowledge on how this could have only just reared its ugly head would be great. I often struggle with the mystery side of these things.
if(isset($_FILES['article_main_image']) && $_FILES['article_main_image']['size'] > 0){
$filename = $this->input->post('article_title') . '_' . time();
$config['upload_path'] = './resource/data/tmpstore/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['file_name'] = $filename;
$this->load->library('upload', $config);
if ($this->upload->do_upload('article_main_image'))
{
$uploadData = $this->upload->data();
$filename = $uploadData['file_name'];
//Other stuff here
} else {
$this->session->set_flashdata('validationErrors', $this->upload->display_errors());
$this->session->set_flashdata('postVars', $this->input->post());
redirect('/admin/contenteditor/editarticle?id=' . $this->input->post('articleId'));
}
}