[Koha] How to check a file's MIME type in KOHA

Mark Alexander marka at pobox.com
Wed Feb 8 03:06:33 NZDT 2017


Excerpts from Rejeesh K.Nair's message of 2017-02-07 15:49:42 +0530:
> I have checked the MIME information of a specific file using its extension.
> But actually I need details of exact file.

I'm a newbie with the Koha source code.  But I'm wondering if there
is some way you could use the external "file" program from within
Koha to determine the file type.  This program is not fooled by
file name extensions; it examines the file contents to determine
the type.  Here is an example of a test I ran where I renamed a .pdf
file with .jpg extension in an attempt to fool file:

  $ cp koha-notes.pdf junk.jpg
  $ file -i junk.jpg
  junk.jpg: application/pdf; charset=binary


More information about the Koha mailing list