Modify WordPress to Accept New Filetypes as Uploads
Written by Brian on September 3, 2010 – 7:39 pm -Ran into a new problem with WordPress today. I was working on my photography blog, and I wanted to upload a DNG file (a standardized RAW format) so that people could work along and edit the photo with the Lightroom tutorial. When I tried to upload the photo, I got the unsettling response: “File type does not meet security guidelines. Try another.”
Now I can understand if this was a WordPress.com blog and they had restricted certain filetypes (or another shared host). But this was my blog, gosh darnedit, and I was gonna upload that file if I wanted to…!
A quick search revealed just the type of WordPress hack that I needed. Read the full explanation of how to modify the allowed upload types in WordPress on Chris Meller’s blog. The gist of the solution is that WordPress uses a function, “upload_mimes” to check what file types are allowed. You can add a filter to hijack that function, add your own filetype, and pass that back to WordPress.
I followed Chris’ directions, added ‘dng’ to the array, and it worked like a charm. Awesome.
Posted in CMS Tricks, Nerds at Work | No Comments »
Tags: Wordpress
Find that post enjoyable or informative? Why don't you subscribe to the feed for Nerds at Work. Or, subscribe to the site-wide feed and catch up on all my antics.
No Comments Yet
You can be the first to comment!
