Wordpress error prompt "Sorry, this file type is not supported for security reasons." resolvent

WordPress Tutorial five thousand four hundred and nine

Try uploading with wordpress .apk The error prompt "Sorry, this file type is not supported due to security reasons." appears for the reason that WordPress upload files are not supported .apk Format.

A long time ago, the blog shared it by modifying the source file Add WordPress to allow uploading attachment format In fact, you can directly add functions to the functions.php file of the topic.

Add the following code to the functions.php file:

 one two three four five
 function add_file_type ( $mimes  =  array ( ) )  {
	 $mimes [ 'apk' ]  =  "text/apk" ;
	 return  $mimes ;
 } add_action ( 'upload_mimes' ,  'add_file_type' ) ;

The above code indicates adding files that support the apk type. If you need to add other types, such as css, change the code to:

 one
 $mimes [ 'css' ]  =  "text/css" ;

If multiple types need to be added, add a line directly below, such as:

 one two
 $mimes [ 'apk' ]  =  "text/apk" ;
 $mimes [ 'css' ]  =  "text/css" ;

Save the file finally

Highlight: