me1000 Posted February 16, 2008 Share Posted February 16, 2008 How do you get the MIME (filetype) of a file that is on your server? for example: the path of the file is /users/root/123/file.jpg so $file = '/users/root/123/file.jpg'; is there a PHP function to get the MIME info from that file? which in this case would be image/jpeg Thanks, Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/ Share on other sites More sharing options...
Chris92 Posted February 16, 2008 Share Posted February 16, 2008 mime_content_type(); Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/#findComment-468424 Share on other sites More sharing options...
me1000 Posted February 16, 2008 Author Share Posted February 16, 2008 thank you... Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/#findComment-468425 Share on other sites More sharing options...
me1000 Posted February 16, 2008 Author Share Posted February 16, 2008 hmmm... I am getting an undefined function error, $fileType = mime_content_type($file); Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/#findComment-468432 Share on other sites More sharing options...
Chris92 Posted February 16, 2008 Share Posted February 16, 2008 Check the finfo_open function, I've never used it but it might be able to retrieve the same info, I'm not sure. Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/#findComment-468437 Share on other sites More sharing options...
me1000 Posted February 16, 2008 Author Share Posted February 16, 2008 it says that function isn't defined either... Link to comment https://forums.phpfreaks.com/topic/91420-get-filetype/#findComment-468438 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.