WordPress media upload security block .js .css and other mime types.

Add this code to your theme functions.php file.
//restrict mime type uploads
// If the function exists this file is called as upload_mimes.
// We don't do anything then.
if ( ! function_exists( 'fb_restrict_mime_types' ) ) {
add_filter( 'upload_mimes', 'fb_restrict_mime_types' );
/**
* Retrun allowed mime types
*
* @see function get_allowed_mime_types in wp-includes/functions.php
* @param array Array of mime types
* @return array Array of mime types keyed by the file extension regex corresponding to those types.
*/
function fb_restrict_mime_types( $mime_types ) {
$mime_types = array(
'pdf' => 'application/pdf',
'doc|docx' => 'application/msword',
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
);
return $mime_types;
}
}
// If the function exists this file is called as post-upload-ui.
// We don't do anything then.
if ( ! function_exists( 'fb_restrict_mime_types_hint' ) ) {
// add to wp
add_action( 'post-upload-ui', 'fb_restrict_mime_types_hint' );
/**
* Get an Hint about the allowed mime types
*
* @return void
*/
function fb_restrict_mime_types_hint() {
echo '<br />';
_e( 'Accepted MIME types: JPG, PNG, GIF, BMP, PDF, DOC/DOCX' );
}
}
// If the function exists this file is called as upload_mimes.
// We don't do anything then.
if ( ! function_exists( 'fb_restrict_mime_types' ) ) {
add_filter( 'upload_mimes', 'fb_restrict_mime_types' );
/**
* Retrun allowed mime types
*
* @see function get_allowed_mime_types in wp-includes/functions.php
* @param array Array of mime types
* @return array Array of mime types keyed by the file extension regex corresponding to those types.
*/
function fb_restrict_mime_types( $mime_types ) {
$mime_types = array(
'pdf' => 'application/pdf',
'doc|docx' => 'application/msword',
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
);
return $mime_types;
}
}
// If the function exists this file is called as post-upload-ui.
// We don't do anything then.
if ( ! function_exists( 'fb_restrict_mime_types_hint' ) ) {
// add to wp
add_action( 'post-upload-ui', 'fb_restrict_mime_types_hint' );
/**
* Get an Hint about the allowed mime types
*
* @return void
*/
function fb_restrict_mime_types_hint() {
echo '<br />';
_e( 'Accepted MIME types: JPG, PNG, GIF, BMP, PDF, DOC/DOCX' );
}
}