Support » Requests and Feedback » Add rar to functions.php



    rar is partially added as a mime type in function.php but is not fully implemented.

    Would it be possible to add
    ‘rar’ => ‘application/x-rar-compressed’,
    to the
    $mimes = apply_filters( ‘upload_mimes’, array(
    list of supported types.

    It already is included in the list at
    function wp_ext2type( $ext ) {
    $ext2type = apply_filters( ‘ext2type’, array(
    so it is a bit odd that it was missed.

Viewing 1 replies (of 1 total)
  • Try adding this to your themes functions.php file. I just tested it on 3.1. Before I couldn’t upload .rar extension. After I could.

    add_filter('upload_mimes', 'custom_upload_mimes');
    function custom_upload_mimes ( $existing_mimes=array() ) {
    	// add the file extension to the array
    	$existing_mimes['rar'] = 'mime/type';
            // call the modified list of extensions
    	return $existing_mimes;

    …if that is what you are asking, of course.

Viewing 1 replies (of 1 total)
  • The topic ‘Add rar to functions.php’ is closed to new replies.