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

Rejeesh K.Nair rejeeshknair at gmail.com
Wed Feb 8 18:01:46 NZDT 2017


Hi Mark,

Your sample code meets my requirement. But I need to implement this for
each uploading file in KOHA code.

Regards,
Rejeesh K.Nair

On Tue, Feb 7, 2017 at 7:36 PM, Mark Alexander <marka at pobox.com> wrote:

> 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
>



-- 
Thanks & Regards,

Rejeesh K.Nair
m: +91 (0) ​9495316906
e: rejeeshknair at gmail.com
<https://www.facebook.com/rejeeshnairk> <https://twitter.com/rejeeshknair>
<http://in.linkedin.com/in/rejeeshknair>
<https://www.instagram.com/rejeeshknair/>


More information about the Koha mailing list