views:

154

answers:

2

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.................

+1  A: 

$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.

Gabriel Evans
A: 

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 ;)

Nort