how to upload zip/rar files in codeigniter
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|multipa开发者_如何转开发rt/x-zip';
but not working . please help me.................
$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.
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 ;)
精彩评论