Love2c0de Posted May 15, 2012 Share Posted May 15, 2012 Hello, I am designing a site which alows users to upload a certain file type, namely .dem files (gaming demo files). I have tried using mime_content_type(); but it doesn't output anything. I looked at php.net and viewed the example code and tried exactly what they did. As I say, doesn't output anything though. The code is: <?php echo mime_content_type('smuggles.dem'); ?> I have this code in a file called test.php and the demo file is in the same folder as this file... (wamp/www) php.net states the function is deprecated and advises you to use Fileinfo(). Is this the reason it doesn't work because I was advised from another forum to use the mime_content_type() function. Please if you can help me I would be very grateful. I have been stuck on this for a few days now and have received no more replies from the other forum since my last post. I also thought that coming to a php dominant forum would really help my chances of achieving this. Kind regards, BuNgLe. Quote Link to comment https://forums.phpfreaks.com/topic/262580-finding-out-file-format-using-mime_content_type/ Share on other sites More sharing options...
darkfreaks Posted May 15, 2012 Share Posted May 15, 2012 http://us2.php.net/manual/en/function.finfo-file.php Quote Link to comment https://forums.phpfreaks.com/topic/262580-finding-out-file-format-using-mime_content_type/#findComment-1345737 Share on other sites More sharing options...
Love2c0de Posted May 15, 2012 Author Share Posted May 15, 2012 So the example code they give here: <?php $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension foreach (glob("*") as $filename) { echo finfo_file($finfo, $filename) . "\n"; } finfo_close($finfo); ?> How do I set the $filename variable to the specified file? Sorry but I do not understand exactly how finfo works. Regards, BuNgLe. Quote Link to comment https://forums.phpfreaks.com/topic/262580-finding-out-file-format-using-mime_content_type/#findComment-1345741 Share on other sites More sharing options...
Love2c0de Posted May 15, 2012 Author Share Posted May 15, 2012 After I download the PECL extension files, where do I extract the files to? I am using WAMP. Regards, BuNgLe Quote Link to comment https://forums.phpfreaks.com/topic/262580-finding-out-file-format-using-mime_content_type/#findComment-1345746 Share on other sites More sharing options...
darkfreaks Posted May 16, 2012 Share Posted May 16, 2012 http://jeffreybarke.net/2009/02/using-the-php-fileinfo-extension/ Quote Link to comment https://forums.phpfreaks.com/topic/262580-finding-out-file-format-using-mime_content_type/#findComment-1345771 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.