Thursday, November 14, 2013

Wordpress: Adding file type exceptions for uploading

You need to add and modify the following in the theme's functions.php file:

 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;  

A list of MS Office file formats >>

No comments:

Post a Comment