Re: Mime Magic functions - how standard are they?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/3/07, Dave M G <martin@xxxxxxxxxxxxx> wrote:
> So, ultimately, what I'm wondering is, what should I be using in order
> to determine file MIME types that will be the most commonly installed on
> servers with PHP?

I wrote something that does system("file -iNr $file") which gives you
the application/mime-type output. the problem is that it was video
files, and a bunch of the microsoft video formats wind up showing up
as just generic binary data, just like executable files. I wound up
disabling it as I could not rely on it (I had to say "skip *.wmv from
processing" which rendered the whole point of this useless)

Depending on what you need the output for, that could work quite well.
Look into using file through the system() call. From the file types
you listed above I think it can identify them pretty well. Adjust the
options as needed. I decided to go that route instead of trying to
find a PECL or PEAR solution (or I checked and it didn't seem like a
good one was available at the time)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux