elegant themes

How to get around WordPress’ limitation on uploading certain file types

| March 16, 2010 | 4 Comments

One of our clients needed to upload files via their admin, and kept getting the following error message: “File type does not meet security guidelines. Try another.”

This was something new to us, and after doing some research we discovered that WordPress only allows users to upload certain types of files, and any files that are not part of that list cannot be uploaded through the admin. Here’s the list of accepted WordPress files types.

It turns out that the list of accepted file types is found in wp-includes/functions.php. Since we don’t want to modify WordPress core files, we need a solution like a plugin in order to get around this limitation.

Chris Meller has a solution that involves adding some code to your functions.php file in your theme directory. He also explains how to remove file types from the list of allowed files types.

For more info on how to do this, see this post on his blog: Modifying Allowed Upload Types in WordPress.

Thanks to Mark Kaplun for helping us find this solution.

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Tags: ,

Category: Code Snippets

About Miriam Schwab: Miriam is the friendly CEO of illuminea, a WordPress design and development agency. Miriam is a huge fan of WordPress and has been using it for over five years now. In addition, Miriam and her team have been organizing the local Israeli WordCamp conferences for the past few years. View author profile.

Elegant WP Themes

Comments (4)

Trackback URL | Comments RSS Feed

  1. Jennifer says:

    Needless-to-say, I am very surprised to hear that these same file type restrictions also exist in self-hosted ORG blogs.

  2. Jennifer says:

    Here’s an article I found on ORG about attachments. File types at the bottom. Same-same, but different. :)

  3. Andreas says:

    Hello Miriam.
    Quite a while ago this post but – did you came over the mime-config plugin?
    http://wordpress.org/extend/plugins/pjw-mime-config/
    I installed it and now i can upload .tgz archives after i added the mime type.
    For a list of possible mime-types see: Multimedia MIME Reference

    • Tom Qazan Sagawa says:

      This plugin is awesome.
      however i wanted my authors to send only images for now so i edited the plugin

      removed :  return array_merge($mimes,$this->mime_types); (line 265 , merges wp acceptes types with your custom ones)
      replaced it with :     return $this->mime_types;
      so that only the files i specify in the mime type managment plugin will be allowed (overriding all of WordPress’s default accepted types).

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.

More in Code Snippets (11 of 31 articles)