How To Upload Additional File Types To Your WordPress Blog

Writing simply the content in WordPress  is not enough for creating a good weblog. To enhance the user experience and interactivity of the website, you need to upload different types of files along with the content. WordPress does allow this in a very convenient way. It gives you the freedom to upload media files and content, but not all file types are supported.

You  might be able to upload your .doc (or .docx) or .pdf files in WordPress but .ppt and .dll files are restricted stating that your file type does not meet security guidelines. To allow uploading the powerpoint files to WordPress site, you can simply go ahead and customize functions.php with the following code.

Locate the filter upload mimes and add the extensions for the type of files you want to upload to the website. The filter allows you to set the mime type for your extension so as to make the extension permissible for uploading.

 add_filter('upload_mimes', 'custom_upload_mimes');
 function custom_upload_mimes ( $existing_mimes = array() ) {
 // add your extension to the array
 $existing_mimes['ppt'] = 'application/';
 // or: $existing_mimes['ppt|pot|pps'] = 'application/';
 // to add multiple extensions for the same mime type
 // add as many as you like
 // removing existing file types
 unset( $existing_mimes['exe'] );
 // add as many as you like
 // and return the new full result
 return $existing_mimes;

Similarly to allow uploading .dll files you can use $existing_mimes[‘dll’] = ‘application/x-msdownload’.

You can learn more about mime types at W3Schools.

Divi WordPress Theme