Managing mime-types for the inline-uploader

Some people want to be able to extend the list of mime-types supported by the WordPress inline-uploader. There are a number of different ways in which this could be achieved ranging from adding a option to allow any file type through to a plugin which allows easy configuration of an extra list of mime-types through the administration interface.

Seeing as a hook exists (upload_mimes) to filter the list of supported mime-types it is fairly easy to knock together a simple plugin which adds a set of mime-types.

< ?php
/*
Plugin Name: mime-type adder
Description: Adds extra mime-types
Author: Peter Westwood
Version: 0.01
Author URI: http://blog.ftwr.co.uk/
*/
add_filter('upload_mimes','pjw_upload_mimes');
function pjw_upload_mimes($mimes)
{
$mime_types = array ('ac3' => 'audio/ac3', 'mpa' => 'audio/MPA', 'flv' => 'video/x-flv');
return array_merge($mimes,$mime_types);
}
?>

However simple that plugin may be it doesn’t give you a nice admin interface and an easy way to manage the list in future which is where my new plugin WordPress mime config steps in. The plugin adds a new options page as Options … Mime-types which allows you to add/delete the extra mime-types.

screenshot of the plugins options page

By default the following extra mime-types are registered: audio/ac3, audio/MPA and video/x-flv.

The latest version of the plugin may be downloaded here: pjw-mime-config.0.50.zip

11 thoughts on “Managing mime-types for the inline-uploader

  1. drivingmenuts

    That didn’t work either. Your comments plugin is screwing up my attempts to provide the solution to a problem.

    Line 98: you forgot the php after the angle-question php delimiter.

  2. drivingmenuts: Yes I do seem to have included some shorttags in the plugin code oops. I will fix this in an updated version together with some other new features I hope to release soon time permitting.

  3. Pingback: Peter Westwood » pjw-mime-config v0.90 released

  4. Pingback: Vie de Malchance

  5. The “Add mime-types from file” feature gives me an error

    Error: Missing a temporary folder.

    Thanks.

    Leslie

  6. I was hoping it meant something other than that. What verbiage shall I use when explaining it to the tech support guys?

    What I’m trying to do is create a barebones document management system using WordPress as a CMS. I work for a small company that has NOTHING in the way of document control, so the act of stuffing them all in the same place, dated, categorized and tagged, is going to give us a big head start.

    I entered several mime types manually and was able to upload the new file types. Thanks for the great plugin.

  7. Quick Question:
    I am using a txt file in my blog:
    Example Post
    When I click on the file it opens it –> how can I set it to download instead?

    I appreciate your Help

    Mike

Comments are closed.