WordPress by default limits the number of file types, that you can upload on WordPress site for a good reason. You can try this yourself. Just create a new post. Then select “Add Media”. Then try to upload an “EXE” file or a “PHP” file. WordPress will reject that file with a nice security reason.
WordPress allows to customize the allowed file types with WordPress hooks. You just have to update your theme’s function.php with a few lines of code and you will able to upload those types of files. For some people, this way is OK but for others, who are constantly uploading different types of files on their blog, this is not a good solution.
Disabling The Filtering
This process of disallowing certain types of files in WordPress is known as filtering. You can simply disable this filtering by using following code. You have to add it in your wp-config.php.
define('ALLOW_UNFILTERED_UPLOADS', true);
Note: Now you have allowed upload for all types of file on your blog. This may lead to serious security issues. Take care that any file uploaded on the server can be executed if it is not managed properly.
thanks ^_^
Thanks for that; I didn’t know of that possibility.
Since your post is the top hit on Google for this subject, though, it might be worth mentioning the alternative of extending WordPress’s whitelist with the
upload_mimes
filter – probably safer than disabling the filter if you just want to add a single MIME type.Ref: https://codex.wordpress.org/Plugin_API/Filter_Reference/upload_mimes
Thank you very much for sharing this tip – it came in handy today!
Thanks Its really help for me …