Reputation: 9585
I am creating file upload functionality for my blog using codeigniter. in that i am accepting two formats zip|rar.
It gives error as The filetype you are attempting to upload is not allowed.. Its working fine if change it to other format like image or txt .
Please find the code snippet
$config['upload_path'] = './public/';
$config['allowed_types'] = 'zip';
$config['max_size'] = '6000';
//$config['file_name'] = $authorName.$config['file_ext'];
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload()){
$data['serverMessage'] = "E75";
$data['uploadError'] = $this->upload->display_errors();
$data['message'] =$this->upload->display_errors();
}else{
$data['message'] ="Thanks you";
}
$this->output->set_header("HTTP/1.0 200 OK");
$this->output->set_header("HTTP/1.1 200 OK");
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0");
$this->output->set_header("Pragma: no-cache");
$this->load->view('guestpost', $data);
Upvotes: 0
Views: 2178
Reputation: 120
Add 'application/octet-stream' at the end of zip at config/mimes.php ...
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/s-compressed', 'multipart/x-zip', 'application/octet-stream')
Upvotes: 2
Reputation: 826
this answer may help you
try to change the MIME.php configuration
Upvotes: 0