[imp] attachment MIME types

Liam Hoekenga liamr at deathstar.org
Thu Jan 11 07:54:58 PST 2007


>>>> Does anyone have information on how to change / correct the MIME 
>>>> types that browsers assign to files?  (Various browsers / various 
>>>> platforms?) We've been asked about it here at UMich, and I think 
>>>> this would be useful information for the User FAQ.
>>>
>>> I just disable the browser detected mime type and use the mime-magic 
>>> code in the Horde library, as I've found that if IE uploads a file 
>>> which is held open by an application e.g. Word, then the mime type 
>>> supplied by IE is wrong. I'm pretty sure this has been discussed on 
>>> this list in the past.
>>>
>> Graeme -
>>
>> Do you just comment stuff out in the Horde MIME library code?   The 
>> "MIME Detection" tab in setup isn't exactly helpful here.
>
> Well I think you can either not compile in mime_magic support in PHP, 
> though that might have other consequences, or do what I do and edit 
> lib/Horde/MIME/Magic.php and comment out the lines:
>
> //        if (Util::extensionExists('mime_magic')) {
> //            return trim(mime_content_type($path));
> //        } else {
>
>         ...
>
> //    }
>
> This will then force it to read the contents of the file and match it to
> a "magic" file of file types. It means more PHP needs to run but it does
> seem to solve the IE with open files problem for us.
>
I would think that this would prevent the Horde MIME library from using 
the mime_magic extension to identify what the file is.   I'm pretty sure 
the browser MIME settings show up in the POST headers when you upload 
the file you're attaching.. so I'm not sure how disabling this code 
would disable the browser detected mime type (unless mime_magic is what 
is used to get the MIME type out of the headers?)

Liam


More information about the imp mailing list