It is possible, as far as i know, to use the unix command "file -bi 
<filename>" and parse the returned result. It works very fine, but, 
unfortunatedly ;^)) just on Unix/Linux/*nix. Have read this on the [Zope] 
list and tested myself.



Em Monday 22 October 2001 16:33, Casey Duncan escreveu:
> Problem: Getting Zope to properly detect MIME types of posted files
>
> The current solution is to try the following methods:
>
> 1. See if the browser specified a type and if so, use it.
> 2. See if the file extension can be recognized and derive a mime-type from
> it 3. Do some inspection of the file data (limited to text files at
> present)
>
> Obviously #1 is preferred, and anytime the browser supplies the mime type,
> method #2 and #3 are never used. However, I have found a problem with this.
> Sometimes, IE reports a mime-type of "application/octet-stream" on files
> that is doesn't know better about.
>
> This specifically happens on WordPerfect files. Now, I am as shocked as you
> are that a competitor's file format would not be recognized by IE, however,
> difficult as this may be to believe, it appears to be true.
>
> My proposed solution and change in behavior is to ignore the browser
> supplied type if it is "application/octet-stream" and use #2 and perhaps #3
> in that case to delve in further. Obviously this may pose a problem for
> applications that rely on the mime-type for files with extensions that
> might otherwise indicate something else. But since this behavior seems
> restricted to IE (amongst the browsers I tested), I doubt it would cause
> harm or breakage.
>
> Thoughts?
>
> I will supply the necessary patches if there is no objection.
>
> /---------------------------------------------------\
>   Casey Duncan, Sr. Web Developer
>   National Legal Aid and Defender Association
>   [EMAIL PROTECTED]
> \---------------------------------------------------/
>
> _______________________________________________
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )

-- 
Sidnei da Silva
X3ng Consultoria e Desenvolvimento Ltda.
[EMAIL PROTECTED]

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to