Upload xls or xlsx files with codeigniter, mime-type error

后端 未结 4 1364
我寻月下人不归
我寻月下人不归 2020-12-03 15:20

Well, i believe this is not a Codeigniter problem per se as it is more of a mime-type.

I\'m trying to upload a file, a xls (or xlsx) file a

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 16:12

    This was a CI bug a few months ago: https://github.com/EllisLab/CodeIgniter/issues/394 . mimes.php in the framework was updated and the bug was resolved. Update your CodeIgniter library to 2.1.0 (or newer).

    Also a good thing to test/dump are your server mime types.

    Another alternative is forcing the mime type. With .htaccess, that would be

    AddType application/excel .xls .xlsx
    

    For a whole debugging adventure, test various office files with get_mime_by_extension($file) with the File Helper (http://codeigniter.com/user_guide/helpers/file_helper.html)

提交回复
热议问题