Reputation: 139
how to upload zip/rar files in codeigniter itried like this
$config['allowed_types'] = 'application/x-zip|application/x-zip-compressed|application/octet-stream|application/x-compress|application/x-compressed|multipart/x-zip';
but not working . please help me.................
Upvotes: 1
Views: 6107
Reputation: 2041
Maybe, your problem is that you want to upload a non-image file type. Theres a bug in codeigniter's upload library, around the 566th line.
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
I've commented it out, so i can upload non-image files as well.
I really hope this helps ;)
Upvotes: 0
Reputation: 772
$config['allowed_types'] is a list of permitted extensions rather than mimetypes. Instead you would use:
$config['allowed_types'] = 'zip|rar';
Check the CodeIgniter user guide on File Uploading.
Upvotes: 2