How do you upload doc and docx files in CodeIgniter

When you trying to upload doc or docx files with CodeIgniter upload library, are you getting the error something like the below.

  • The filetype you are attempting to upload is not allowed.

You can easily fix this error by modifying mimes.php file in CodeIgniter. Change doc and docx mime types for solve the CodeIgniter doc and docx upload problem. Open the application/config/mimes.php file and change the mime types array of doc and docx with the following mime types.

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

Just replace doc and docx elements value with the above mime types array.

Leave a reply

CodexWorld Newsletter

Subscribe CodexWorld updates via email and get every new post delivered to your inbox.