|
finfo_open
Create a new fileinfo resource
(PECL fileinfo:0.1-1.0.4)
Example 617. Object oriented style<?php Example 618. Procedural style<?php Code Examples / Notes » finfo_opencs
the "close" method does not exists, as it is the default deconstructior there is no need to call it.
tularis
On Windows systems people might find that this always returns "application/x-dpkg". There are 2 ways of solving this problem: 1. Get the mime-magic database file from GnuWin32 at <http://sourceforge.net/projects/gnuwin32/> 2. You can manually "fix" the mime-magic file by editing it and escaping all lines starting with !, thus changing each one to \! aldoh
Here is the exact link for Win32user to the file binary package: http://sourceforge.net/project/showfiles.php? group_id=23617&package_id=18878 ian
Couldn't get finfo to return the mimetype in the way expected so i made a function to do it with system() <?php function get_mime_type($filepath) { ob_start(); system("file -i -b {$filepath}"); $output = ob_get_clean(); $output = explode("; ",$output); if ( is_array($output) ) { $output = $output[0]; } return $output; } ?> hope it works for other people too |