[kwlug-disc] PHP question -- how best to determine the content type of some bytes?

Robert P. J. Day rpjday at crashcourse.ca
Mon Mar 8 11:44:05 EST 2010


  what's the most comprehensive way for a PHP script to determine the
mime/content type of an incoming stream of bytes?  i'd like to assume
that i will receive nothing more than the bytes -- no filename, no
extension, etc.

  i see things like getimagesize(), mime_content_type() (which is
listed as deprecated), the FileInfo structure, etc.  any
recommendations on what the standard is these days?  i'd like to be
able to recognize and categorize as many image, audio and video
formats as possible.

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================




More information about the kwlug-disc mailing list