Take the 2-minute tour ×

I'm attempting to upload a .docx using the upload helper in Codeigniter.

public function upload($id,$type){
        $folder = $type;
        $config['upload_path'] = RESOURCE_PATH . $folder;
        $config['allowed_types'] = 'pdf|doc|docx';
        $config['max_size'] = '100000';
        //$this->load->library('upload', $config);
        if (!$this->CI->upload->do_upload('userfile')){
            echo $this->CI->upload->display_errors();

The upload function works fine on my local host. However, when I try uploading the .docx file on the server I get "The filetype you are attempting to upload is not allowed".

I can upload other files on the server and the code is an exact copy of what I have locally. I also googled around and found some people changed the mime for .docx to:

'docx'  =>  array('application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/octet-stream')  

but that doesn't seem to have resolved the issue. What could be going wrong and how do I resolve the issue so I can resolve this issue?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Try to add this mime type: application/zip to application/config/mimes.php for docx. It works for me. If it not help. Open system/libraries/Upload.php(line 205) and do this:


You will see file type of you .docx and need to add it to docx mimes list in config.

share|improve this answer
This helped me answer the question. For some reason it was seeing it as "application/x-zip". I added this to the mime type for docx and it worked. –  Sheldon Aug 14 '13 at 15:47
Few weeks ago's I had a similar problem. Glad, what my desicion is helpful for you. –  joni jones Aug 14 '13 at 16:49
Thanks for the solution, for my case it was displaying inode/x-empty which i added in mimes and it worked. –  Anupal Jul 21 at 11:42
For me the mime type 'application/zip' was already but upload of .docx was not working. Adding 'application/msword' made it work. So it seems, one has to try it out. Yes, checking the file_type as you suggested, pretty much helps and solves the problem. Not sure if the difference is coming because of server settings –  nitigyan Sep 9 at 12:09

Your Answer


