WordPress Error : Sorry, this file type is not permitted for security reasons

.svg and .xap files can result in the error "Sorry, this file type is not permitted for security reasons." when uploading. 

You can work around the error by adding the following to your theme's functions.php file:


add_filter('upload_mimes', 'custom_upload_mimes');

function custom_upload_mimes ( $existing_mimes=array() ) {

	// add the file extension to the array

	$existing_mimes['svg'] = 'mime/type';

        // call the modified list of extensions

	return $existing_mimes;

}


or:


add_filter('upload_mimes', 'custom_upload_mimes');

function custom_upload_mimes ( $existing_mimes=array() ) {

	// add the file extension to the array

	$existing_mimes['xap'] = 'application/x-silverlight-app';

        // call the modified list of extensions

	return $existing_mimes;

}
  • 162 Users Found This Useful

Was this answer helpful?

Related Articles

JetPack says my website is offline

Sorry to hear that your website is offline. Here are some things you can do to troubleshoot the...

WordPress error "The uploaded file could not be moved to"

WordPress Upload Error If you're getting the error message "The uploaded file could not be moved...

WordPress Site Search

Adding search functionality is a wonderful way to add functionality and pleasure to a visitors...

504 error - Are you sure you want to do this?

In wordpress if you receive either of the following errors when trying to upload a theme... 504...

CloudFlare for WordPress

The Cloudflare plugin for WordPress is a free plugin that allows you to connect your WordPress...