Fixing OpenDocument MIME magic on Linux

Posted by Sander_Marechal on Jun 28, 2009 2:41 PM EDT
Lone Wolves; By Sander Marechal, The Netherlands
Mail this story
Print this story

When working on the beta of Officeshots.org I ran into an interesting problem with file type and MIME type detection of OpenDocument files. When a user uploads an ODF file to Officeshots I want to determine the MIME type myself using the PHP Fileinfo extension. On Linux, the PHP Fileinfo extension relies on the magic file that is provided by the file package. The magic file contains a series of tests that can determine the file type and MIME type of a file by its contents. I found out that the magic file is incomplete for OpenDocument files. In this article I will show you what is wrong with the magic file and how you can fix it.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux, PHP

« Return to the newswire homepage

Subject Topic Starter Replies Views Last Post
excellent! tuxchick 7 1,151 Jul 1, 2009 3:10 PM

You cannot post until you login.