By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,834 Members | 2,234 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,834 IT Pros & Developers. It's quick & easy.

Checking file type of a file in perl

100+
P: 129
Hai friends,
I have a doubt that if we are having a page which having the functionality to upload a file, then if we want to restrict to some types of files only have to be uploaded ex:- jpg,png.... .Then i am using Apache2::Upload module in which we can get the type of file using type function.

But the users are very smart than me. They changed the extension of pdf file into jpg and they are uploading the files. This is succeeding because Apache2::Upload module will checks the file type by extension.

When i searched i got File::Type module and it working in perl file means .pl, if i wants to work same in .pm(Modperl) file then it is not working.

Can any one say why it is not working (or) is there any other module or other way to find the file type by its data, not by extension. Please help me friends.
Jan 8 '10 #1
Share this Question
Share on Google+
1 Reply


numberwhun
Expert Mod 2.5K+
P: 3,503
Ok, we are going to need a bit more information before we can help you discover what is wrong. There is a world of difference between a .pl file (which is a Perl file containing standard windows code for execution) and a .pm file (which is a Perl module file, which is a bit different from a regular script file).

Can you be more specific as to what you have put in both? How about putting your code here, in code tags, for each file. That will help us get a visual. Also, please describe what you are or are not seeing with both files executions.

Regards,

Jeff
Jan 8 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.