[RCD] mime problem - excel file as text/plain

Balazs Horvath balazs.horvath at weboor.net
Wed Mar 4 13:54:59 CET 2009

Thomas Bruederli, 09.01.22 17:13:
>> (...)
> That server-side mime-type detection seems to cause more problems than
> solving them. I tend to switch back and just trust the mime-type
> submitted by the client (when uploading). It always worked well for me
> but I'm not using Windows...
> ~Thomas   

I'm digging more deep and deep in this attachment problem.

- it is for detecting mime type by so called magic numbers

- on the same server, when calling file -bi and finfo_open on the same
doc file it gives you different results

        file Munka1.xls
        Munka1.xls: Microsoft Office Document

        /usr/php5fcgi/bin/php-cgi fileinfo.php
        Content-type: text/html

       So file gives you right, but finfo_open does not.

Actually for docx files it will always detect ZIP as format, because
it's actually a zip, and this will never change!

IMHO we can keep using fileinfo, but we need to combine it with
- extension based method
- using the client submitted mime-type

I like arekm's solution
what if we put the list to a external config file, so this can be an option.
If admin wants, he can override the detection of some extensions.

What do you think?


List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list