[Koha] How to check a file's MIME type in KOHA
Rejeesh K.Nair
rejeeshknair at gmail.com
Tue Feb 14 19:11:51 NZDT 2017
Hi All,
Many thanks for all your timely support , We got a solution for checking
MIME type. Here I am sharing the code snippet I have used to solve it .
Please see the code and share your comments.
my $file = $query->param("id_list_file");
my $tmpfilename = $query->tmpFileName($file);
my $mimeinfo = `file -i -b $tmpfilename`;
my @fields = split /;/, $mimeinfo;
my $mimetype = $fields[0];
#print $mimetype;
if($mimetype eq 'application/marc' ){
//Required action
}else{
//Required action
}
Regards,
Rejeesh
On Wed, Feb 8, 2017 at 2:03 PM, Holger Meissner <
Holger.Meissner at hs-gesundheit.de> wrote:
> Hi Rejeesh,
>
> there are a few ways to execute a system command from perl code. You can
> use
> http://perldoc.perl.org/functions/system.html
>
> Not sure if that's the best solution.
>
> Regards
> Holger
>
> Rejeesh K.Nair wrote:
> > 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
> _______________________________________________
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>
--
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