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 Responses to “Managing mime-types for the inline-uploader”

  1. Ralf says:

    Great work, I had lots of trouble, all my old download links stopped working once I had upgraded from WordPress 2.7 to WordPress MU 2.6.5. All I had to do is install your plugin, add the mime types for pps and txt files and it worked.
    Thanks a lot, great work



d
go to dashboard
l
go to login
h
show/hide help
e
edit post/page
r
comment on post/page
m
go to moderate comments
esc
cancel
%d bloggers like this: