How to upload .jar file in WordPress?

I want to upload jar in my WordPress website. But it seems that WordPress does not allow to upload this type of file. I am using WordPress 3.8.2. Any help and suggestion is greatly appreciated.

Related posts

Leave a Reply

2 comments

  1. Rather than editing core files (which is always a bad idea), you should consider adding a filter by hooking into the mime_types filter:

    /**
     * Add JAR file type to list of allowed extensions 
     * 
     * @param array $types Default allowed mime types
     */
    function so23113552_custom_mime_types( $types ) {
    
        $types['jar'] = 'application/java-jar';
    
        return $types;
    }
    add_filter( 'mime_types', 'so23113552_custom_mime_types' );