WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding mime types with plugin (7 posts)

  1. Josh Maxwell
    Member
    Posted 2 years ago #

    I've tried a few plugins to add mime types including the PJW Mime Config plugin; and, adding this code to a themes functions.php file could probably work, too, for a non-WPMS site. But I need these new mime-types allowed throughout the network.

    So I've written my own plugin to do the trick. After looking at info from the codex as well several blog posts, this is what I've come up with:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    After activating the plugin on a 3.2.1 WPMS as well as a single 3.2.1 install, I'm experiencing problems. Upon activation:

    The plugin generated 3 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    Then when I attempt uploading a file matching one of the new mime-types I receive my original error message:

    Warning: Cannot modify header information - headers already sent by (output started at [server]\wp-content\plugins\tps-mime-types\tps-mime-types.php:1) in [server]\wp-includes\pluggable.php on line 934

    I'm still new to WP, so any suggestions on what to do next?

  2. Josh Maxwell
    Member
    Posted 2 years ago #

  3. Moving to Multisite, as the answers are different than on single-site :)

    You shouldn't need a plugin at all on Multisite.

    Go to youdomain.com//wp-admin/network/settings.php

    Add it to Upload file types

  4. Josh Maxwell
    Member
    Posted 2 years ago #

    Ipstenu, I thought the same thing at first, but when I added the extensions to that page, it still wouldn't work.

    However, I did end up figuring it out! :D

    Here's the new plugin code. If anyone decides to use it: be sure to save code as extended-mime-types.php inside a folder called extended-mime-types/. Also, create a text file called mime-types.txt inside of extended-mime-types/.

    mime-types.txt must be formatted as follows:

    doc,doct application/msword
    pdf application/pdf
  5. KevEd
    Member
    Posted 2 years ago #

    Hi tpschools,
    which directory does the extended-mime-types folder need to be put in?

    I updated my databas tables to list .doc etc - that gets rid of error messages but the files stil don't upload, so I'm trying your code next.

    Cheers.

  6. Josh Maxwell
    Member
    Posted 2 years ago #

    KevEd,

    The files need to be put into \wp-content\plugins\ap-extended-mime-types\

    So, inside the folder new-extended-mime-types, you should now have these files:

    1. mime-types.txt
    2. new-extended-mime-types.php

    Or you can download the plugin. It'll be on the WP repository as soon as I hear back from WordPress. There are no options, you just activate it and let it do it's thing.

  7. Josh Maxwell
    Member
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic