hellonoko Posted December 23, 2007 Share Posted December 23, 2007 My script for returning the mime type of a file does not seem to work: $handle = finfo_open(FILEINFO_MIME); echo $mime_type = finfo_file($handle,$file_name); exit(); Errors: Warning: finfo_open() [function.finfo-open]: Failed to load magic database at '(null)'. in C:\www\idea\imagebox\add_image.php on line 147 Warning: finfo_file(): supplied argument is not a valid file_info resource in C:\www\idea\imagebox\add_image.php on line 148 I did have to turn on php_fileinfo in WAMP for this. Is there something else I need to turn on? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/82903-get-mime-type-of-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 23, 2007 Share Posted December 23, 2007 The page in the php manual states how to specify the parameter in the function call so that the magic.mime file can be found - magic_file Name of a magic database file, usually something like /path/to/magic.mime. If not specified, the MAGIC environment variable is used. If this variable is not set either, /usr/share/misc/magic is used by default. A .mime and/or .mgc suffix is added if needed. The magic.mime file is typically located in the "extras" folder inside the php folder. Quote Link to comment https://forums.phpfreaks.com/topic/82903-get-mime-type-of-file/#findComment-421738 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.