upload_mimes

upload_mimes is a filter that filters the list of mime-types supported by the inline uploader and is called from wp_handle_upload(). It recieves an array containing the current list of mime-types as a parameter and returns the new array of mime-types to be used.

Context:

File: /wp-admin/admin-functions.php
function wp_handle_upload(&$file, $overrides = false) {
        // The default error handler.
        if (! function_exists('wp_handle_upload_error') ) {
                function wp_handle_upload_error(&$file, $message) {
                        return array('error'=>$message);
                }
        }

        // You may define your own function and pass the name in $overrides['upload_error_handler']
        $upload_error_handler = 'wp_handle_upload_error';

        // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
        $action = 'wp_handle_upload';

        // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
        $upload_error_strings = array(false,
                __("The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>."),
                __("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form."),
                __("The uploaded file was only partially uploaded."),
                __("No file was uploaded."),
                __("Missing a temporary folder."),
                __("Failed to write file to disk."));
        // Accepted MIME types are set here as PCRE. Override with $override['mimes'].
        $mimes = apply_filters('upload_mimes', array (
                'jpg|jpeg|jpe' => 'image/jpeg',
                'gif' => 'image/gif',
                'png' => 'image/png',
                'bmp' => 'image/bmp',
                'tif|tiff' => 'image/tiff',
                'ico' => 'image/x-icon',
                'asf|asx|wax|wmv|wmx' => 'video/asf',
                'avi' => 'video/avi',
                'mov|qt' => 'video/quicktime',
                'mpeg|mpg|mpe' => 'video/mpeg',
                'txt|c|cc|h' => 'text/plain',
                'rtx' => 'text/richtext',
                'css' => 'text/css',
                'htm|html' => 'text/html',
                'mp3|mp4' => 'audio/mpeg',
                'ra|ram' => 'audio/x-realaudio',
                'wav' => 'audio/wav',
                'ogg' => 'audio/ogg',
                'mid|midi' => 'audio/midi',
                'wma' => 'audio/wma',
                'rtf' => 'application/rtf',
                'js' => 'application/javascript',
                'pdf' => 'application/pdf',
                'doc' => 'application/msword',
                'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
                'wri' => 'application/vnd.ms-write',
                'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
                'mdb' => 'application/vnd.ms-access',
                'mpp' => 'application/vnd.ms-project',
                'swf' => 'application/x-shockwave-flash',
                'class' => 'application/java',
                'tar' => 'application/x-tar',
                'zip' => 'application/zip',
                'gz|gzip' => 'application/x-gzip',
                'exe' => 'application/x-msdownload'
        ));
...
    

This hook is a filter which means that information is passed through it, and then used by WordPress. Your function needs to accept that information, and return it. Using add_filter('upload_mimes', 'your_function'); helps you to remember this distinction. When you are passing an ID, it is assumed that you will return the ID as it was given to you. With filters that pass strings or arrays, you may manipulate the information before passing it along.

This hook was introduced in WordPress 2.0, and will not work in earlier versions.