manski's blog

Upload arbitrary files to WordPress (new plugin)

WordPress is very restrictive when it comes to file uploads. It’s for security reasons, mainly to prevent bad-behaving users to upload PHP scripts and the like to the blog.

However, if you’re the only one writing posts for your blog, this restriction sometimes is annoying. For example, I do a lot coding in C#. So, when I try to upload a .cs file (C# source code file) to my blog, the upload is rejected.

Wordpress rejected upload with "Sorry, this file type is not permitted for security reasons."

Files are approved or rejected based on their file extension, i.e. the few characters after the dot in the file name, like cs in ArrayClearTest.cs.

WordPress maintains an internal list of which file extensions are allowed. Fortunately, WordPress also allows for this list to be extended.

And that’s what my new WordPress plugin does. It’s called Upload File Type Settings Plugin and allows you to extend that list with an easy-to-use user interface. Go, give it a try.

The plugin's settings page.

No comments yet

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.