I want to use fileinfo extension in PHP (5.5). (On localhost(Windows), using XAMPP)
So I went to php.ini and commented out extension=php_fileinfo.dll
, then I HAVE restarted the apache, even tried to restart the whole PC.
But when I try to use it I still get function/class does not exists ... (procedural/objective)
When I looked to the php_info() page, there is "fileinfo" listed but only among the "Module Authors" table - and that is , I presume, not enaugh - is it?
Does anybody know how to solve this?
PS: I checked the php.ini for magic path and there is mime_magic.magicfile = "\xampp\php\extras\magic.mime"
However there is no such file in the whole xampp folder structure... - could that be a reason why is not loading? Where would I download this file?
Many thanks !
PS2: Solution for others with the same problem who want only images to upload:
$image_size_info = @getimagesize($filename); //surpress errors(@) if not image
if( empty($image_size_info) ) $mime_type = "";
else $mime_type = @image_type_to_mime_type( $image_size_info[2] );
//safety for all cases:
if( empty($mime_type) ) $mime_type = "";
if( strpos($mime_type, "image/") === false ){
//not an Image !
} else {
//proceed file upload
}