WordPress.org

Ready to get started?Download WordPress

Forums

AP Extended MIME Types
Idea: Exclude file types (6 posts)

  1. Ed
    Member
    Posted 2 years ago #

    You have any thoughts about adding exclusion of file types? Can't find anything that does this currently, would love a way to block MP3 uploads without having to edit wp-includes/functions.php.

    Cheers,

    Ed

    http://wordpress.org/extend/plugins/ap-extended-mime-types/

  2. Ed
    Member
    Posted 2 years ago #

    Anyone else interested in this can add the following to the plugin, although there are actually plugins out there that do the same. Would be nice to add either another text file to add exclusions to or write an admin page for it.

    add_filter('upload_mimes', 'restrict_mime');
    function restrict_mime($mimes) {
    $mimes = array(
                    'mp3' => 'audio/x-mpeg'
    );
    return $mimes;
    }

    This will block MP3's being uploaded unless the user has unfiltered uploads on their account.

  3. Josh Maxwell
    Member
    Plugin Author

    Posted 2 years ago #

    Nice one, Ed!

    I'm working on adding a Settings page to edit the text file. I'll see what I can do to get your filter added in, too!

    Cheers!

  4. Ed
    Member
    Posted 2 years ago #

    Cool, I'd double check that code though. Think it broke all uploads when I used it, needs tweaking. Will update when I get a chance to test it again.

  5. vinaysagar4u
    Member
    Posted 2 years ago #

    @Ed: Why dont you just go to your network settings and delete those file types you dont like?

  6. Ed
    Member
    Posted 2 years ago #

    I think I tried that and it still allowed them due to WordPress's defaults.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic