CodeIgniter Forums
.doc and .docx file upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: .doc and .docx file upload (/showthread.php?tid=66576)

Pages: 1 2


.doc and .docx file upload - rupamhazra - 11-07-2016

Hi,

Myself Rupam Hazra.I am facing a problem on my project.Whenever i upload a file type .doc,.docx it rendered a error this file type is not valid.I have searched the solution with this issue but feasible solution didn't find.

So i request you that would you give a solution.

Thanks.


RE: .doc and .docx file upload - InsiteFX - 11-07-2016

Try adding this to your ./application/config/mimes.php

PHP Code:
'doc'    => array('application/msword''application/vnd.ms-office''application/octet-stream'),
'docx'    => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document''application/zip''application/msword''application/x-zip''application/octet-stream'), 

Just add this to the end of them both.

PHP Code:
'application/octet-stream' 



RE: .doc and .docx file upload - rupamhazra - 11-07-2016

Hi ,

I have modified mimes.php file but still showing type errors.

Thanks.


RE: .doc and .docx file upload - InsiteFX - 11-07-2016

Did you check your error log file, it may put the error reason in there.

Some browsers see the mime types different then they are.


RE: .doc and .docx file upload - rupamhazra - 11-07-2016

Hi,

i have checked the log files and showing same error.I have attached the log file with this reply.Please check.


RE: .doc and .docx file upload - salain - 11-07-2016

Have you set the allowed file type in the configuration ?

Have a look there Upload Preferences


RE: .doc and .docx file upload - rupamhazra - 11-07-2016

Yes, Here is my controller code  $config['allowed_types']        = 'gif|jpg|png|doc|pdf|docx';


RE: .doc and .docx file upload - Paradinight - 11-08-2016

@rupamhazra
have you an example doc/docx file and the controller code?



What CI version do you use?


RE: .doc and .docx file upload - rupamhazra - 11-08-2016

@ Paradinight

I am using codeigniter 3.0.0 and i have already modified the settings on mimes.php for .doc and .docx as per @InsiteFX


RE: .doc and .docx file upload - Paradinight - 11-08-2016

(11-08-2016, 09:34 PM)rupamhazra Wrote: @ Paradinight

I am using codeigniter 3.0.0 and i have already modified the settings on mimes.php for .doc and .docx as per @InsiteFX

why 3.0.0 and not 3.1.2?