public static function fileExtType($sExt)
    {
        $aExt2type = array(
            'audio'       => array('aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma'),
            'video'       => array('asf', 'avi', 'divx', 'dv', 'flv',  'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv'),
            'document'    => array('doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd'),
            'spreadsheet' => array('numbers', 'ods', 'xls', 'xlsx', 'xlsb', 'xlsm'),
            'interactive' => array('key', 'ppt', 'pptx', 'pptm', 'odp', 'swf'),
            'text'        => array('asc', 'csv', 'tsv', 'txt'),
            'archive'     => array('bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip'),
            'code'        => array('css', 'htm', 'html', 'php', 'js'),
        );

        foreach ($aExt2type as $type => $exts) {
            if (in_array($sExt, $exts)) {
                return $type;
            }
        }

        return false;
    }
public static function fileExtType($sExt)
    {
        $aExt2type = array(
            'audio'       => array('aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma'),
            'video'       => array('asf', 'avi', 'divx', 'dv', 'flv',  'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv'),
            'document'    => array('doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'rtf', 'wp', 'wpd'),
            'spreadsheet' => array('numbers', 'ods', 'xls', 'xlsx', 'xlsb', 'xlsm'),
            'interactive' => array('key', 'ppt', 'pptx', 'pptm', 'odp', 'swf'),
            'text'        => array('asc', 'csv', 'tsv', 'txt'),
            'archive'     => array('bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip'),
            'code'        => array('css', 'htm', 'html', 'php', 'js'),
        );

        foreach ($aExt2type as $type => $exts) {
            if (in_array($sExt, $exts)) {
                return $type;
            }
        }

        return false;
    }
public static function fileExtType ( $ sExt ) { $ aExt2type = array ( 'audio' => array ( 'aac' , 'ac3' , 'aif' , 'aiff' , 'm3a' , 'm4a' , 'm4b' , 'mka' , 'mp1' , 'mp2' , 'mp3' , 'ogg' , 'oga' , 'ram' , 'wav' , 'wma' ) , 'video' => array ( 'asf' , 'avi' , 'divx' , 'dv' , 'flv' , 'm4v' , 'mkv' , 'mov' , 'mp4' , 'mpeg' , 'mpg' , 'mpv' , 'ogm' , 'ogv' , 'qt' , 'rm' , 'vob' , 'wmv' ) , 'document' => array ( 'doc' , 'docx' , 'docm' , 'dotm' , 'odt' , 'pages' , 'pdf' , 'rtf' , 'wp' , 'wpd' ) , 'spreadsheet' => array ( 'numbers' , 'ods' , 'xls' , 'xlsx' , 'xlsb' , 'xlsm' ) , 'interactive' => array ( 'key' , 'ppt' , 'pptx' , 'pptm' , 'odp' , 'swf' ) , 'text' => array ( 'asc' , 'csv' , 'tsv' , 'txt' ) , 'archive' => array ( 'bz2' , 'cab' , 'dmg' , 'gz' , 'rar' , 'sea' , 'sit' , 'sqx' , 'tar' , 'tgz' , 'zip' ) , 'code' => array ( 'css' , 'htm' , 'html' , 'php' , 'js' ) , ) ; foreach ( $ aExt2type as $ type => $ exts ) { if ( in_array ( $ sExt , $ exts ) ) { return $ type ; } } return false ; }
Convert a file extension to a file type.

Credit: http://core.svn.wordpress.org/trunk/wp-includes/functions.php

@param string $sExt The file extension

@return string      The type
Convert a file extension to a file type .