WordPress.org

Ready to get started?Download WordPress

Forums

Add rar to functions.php (2 posts)

  1. rwheeler@artifact-software.com
    Member
    Posted 3 years ago #

    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.

  2. ClaytonJames
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic