Jerzxu Posted February 5, 2008 Share Posted February 5, 2008 Hello and Good Morning, so here's my question. Basically, I need an alternative to mime_content_type and fileinfo. Reason behind Fileinfo is becuase for some reason I can't get it to work whatsoever, and it's installed on my webserver (Host installed it). It says: Fatal error: Call to undefined function finfo_open(). I asked a fellow PHP programmer and she said that it sounds like they didn't install it. They reinstalled it and it's still the same. As for the mime_content_type, which works well, except it only returns the mimes .jpg, and .gif, meaning that .png, .zip, .rar etc. get put out as text/plain which is bad. Becuase I am trying to limit the mime types to certain ones. So basically if theres a fix for either of these or an alternative to those it would be helpful to have. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 5, 2008 Share Posted February 5, 2008 i was looking at php.com and i found this <?php $finfo = new finfo(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension if (!$finfo) { echo "Opening fileinfo database failed"; exit(); } /* get mime-type for a specific file */ $filename = "/usr/local/something.txt"; echo $finfo->file($filename); /* close connection */ $finfo->close(); ?> try it and see if you get mine types or a error and what error do you get Scott. Quote Link to comment Share on other sites More sharing options...
Jerzxu Posted February 5, 2008 Author Share Posted February 5, 2008 Tried that, the function for finfo doesn't work. Just gives me a undefined function. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 6, 2008 Share Posted February 6, 2008 i did a Google search and found this http://www.phpclasses.org/browse/package/922.html it seems to work good Scott. Quote Link to comment Share on other sites More sharing options...
Jerzxu Posted February 6, 2008 Author Share Posted February 6, 2008 That site it plagued by ads. BUT I shall try it. Quote Link to comment 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.