开发者

Find file MYME-TYPE by using file finfo_file

开发者 https://www.devze.com 2022-12-11 20:51 出处:网络
I am using xampplite1.7.2 which using PHP5.3.0 I am trying to find the file MIME type. But its giving me error:

I am using xampplite1.7.2 which using PHP5.3.0 I am trying to find the file MIME type. But its giving me error:

Call to undefined function finfo_open()

I read the PHP Manual its says that this function support in PHP 5.3 and as i mention that i am using xampplite1.7.2 which using PHP5.3 then why this error occur. I also used

$_FILES['image']['type']

Whi开发者_开发知识库ch is showing me the type correctly. I am very confuse that many people i found told different ways to get MIME-TYPE by using Fileinfo and getimagesize() but none refers to $_FILES['image']['type']. What is the difference in all these functions. Actually i created doc file and then i changed it to JPG by changing its extension. My problem is that when i check the MIME type by using $_FILES['image']['type'] Its showing me image/jpeg is this showing the correct MIME_type and if i use other methods will they show me the correct type of this file which is a .doc file. Because i need to find a way to get the correct type of this file which was .doc. What are the ways to find solve this issue because i am keep trying to solve this issue sine last 24 hours but it seems very difficult to find MIME-type in PHP. i am not very exercised in working with PHP. SO please someone help me to solve this problem. Actually i want to find that the given file is a valid image file or not. Thanks


The fileinfo.so PHP extension may not be enabled by default (it's not in WampServer 2). Check your xampplite config for enabled PHP extensions, enable it if it's not and restart the web server.

0

精彩评论

暂无评论...
验证码 换一张
取 消