mimes.php
'doc' => array('application/msword', 'application/vnd.ms-office'), 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'), 'dot' => array('application/msword', 'application/vnd.ms-office'), 'dotx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip', 'application/msword'), 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip', 'application/vnd.ms-excel', 'application/msword', 'application/x-zip'), 'word' => array('application/msword', 'application/octet-stream'),
var_dump is giving following response
string(24)"application/octet-stream"
This is my some controller code
if(!empty($_FILES['file_name'])) { // Profile Pic upload $config = array(); $config['upload_path'] = 'uploads/file/'; $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|csv|txt|doc|docx|rar|zip|svg|xml|GIF|JPG|PNG|JPEG|PDF|DOC|XML|DOCX|xls|xlsx|CSV|TXT|SVG'; $config['max_size'] =10000; $config['max_width'] = 1024; $config['max_height'] = 1024; $config['file_ext_tolower'] = true; $this->load->library('upload', $config, 'profilepic'); $this->profilepic->initialize($config); if(!$profile_pic = $this->profilepic->do_upload('file_name')) { $this->session->set_flashdata('message', $this->upload->display_errors()); } else { $imgname = $this->profilepic->data(); $imgpath = 'uploads/file/'.$imgname['file_name']; $data['file_name'] = $imgpath; } }else{ $this->session->set_flashdata('message',
‘Please I tried all the possible solution available but not able to succeed.Please suggest.
Advertisement
Answer
I missed docx in controller and adding ‘application/octet-stream’ in docx mimes is solving problem.Thanks for your effort and time.