How to check a file's MIME type in KOHA
Hi All, I need to check the MIME type of each uploaded file for security purposes. Some search results from Google suggest that we can do it with the help of the File::MimeInfo <https://metacpan.org/pod/File::MimeInfo>Perl module. How can we install the File::MimeInfo module in KOHA and check the MIME types, or is there some better way? -- Thanks & Regards, Rejeesh K.Nair m: +91 (0) 9495316906 e: rejeeshknair@gmail.com <https://www.facebook.com/rejeeshnairk> <https://twitter.com/rejeeshknair> <http://in.linkedin.com/in/rejeeshknair> <https://www.instagram.com/rejeeshknair/>
Hi Rajeesh, On Mon, Jan 30, 2017 at 10:52 AM, Rejeesh K.Nair <rejeeshknair@gmail.com> wrote:
I need to check the MIME type of each uploaded file for security purposes.
Some search results from Google suggest that we can do it with the help of the File::MimeInfo <https://metacpan.org/pod/File::MimeInfo>Perl module.
How can we install the File::MimeInfo module in KOHA and check the MIME types, or is there some better way?
IIRC, that sort of generic mimetype detection functionality does not exist in Koha. From the top of my head, the only place where we actively check for mimetype is the image upload option using GD which is basically restricted to a few image formats like PNG, JPEG, XPM etc. Short answer: To implement this on the server side, you have to write the necessary code. As a stop gap, you *could* use the Javascript FileReader object to check the mimetype on the client side. but that is not a fool proof solution. hope this helps. -- Indranil Das Gupta L2C2 Technologies Phone : +91-98300-20971 WWW : http://www.l2c2.co.in Blog : http://blog.l2c2.co.in IRC : indradg on irc://irc.freenode.net Twitter : indradg
participants (2)
-
Indranil Das Gupta -
Rejeesh K.Nair