[imp] attachment MIME types

Graeme Wood Graeme.Wood at ed.ac.uk
Thu Jan 11 08:05:24 PST 2007


On Thu, 11 Jan 2007, Liam Hoekenga wrote:

>
>>>>> 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?)

It does fix it and mime_magic is used to determine the MIME type, I 
believe.

-- 
=============================================================================
Graeme Wood                                 Email: Graeme.Wood at ed.ac.uk
Unix Systems Support                        Phone: +44 131 650 5003
The University of Edinburgh                 Fax:   +44 131 650 6552
=============================================================================


More information about the imp mailing list