[Mimedefang] Blocking unwanted files

Kelson Vibber kelson at speed.net
Tue Dec 9 13:36:00 EST 2003


At 09:52 AM 12/9/2003, Fernando Gleiser wrote:
>Is there a .pm for examining the magic number of the files?

File::MMagic does that.  I believe someone mentioned a module called 
File::Type also, although I haven't looked at that one.  File::MMagic also 
gives you the option of using a magic file from another source (like the 
file command or Apache)

The trick is that, depending on what magic file you use, it will give you 
either a description or a MIME type - not an extension - so you'll need to 
do your own extension-to-type mapping.  Also, some versions of MS Office 
documents are all identified the same, so you'll have to map the generic 
office types to .doc, .xls, .ppt, etc.


Kelson Vibber
SpeedGate Communications <www.speed.net> 




More information about the MIMEDefang mailing list