Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to allow zip files to be uploaded in Wordpress?

I have the following code but it doesn't work.

function custom_upload_mimes($existing_mimes = array()) {

// Add *.EPS files to Media upload
    $existing_mimes['eps'] = 'application/postscript';
// Add *.AI files to Media upload
    $existing_mimes['ai'] = 'application/postscript';
// Add *.AI files to Media upload
    $existing_mimes['3ds'] = 'application/postscript';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/acad';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/x-acad';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/autocad_dwg';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/dwg';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/x-dwg';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'application/x-autocad';
// Add *.dwg files to Media upload
    $existing_mimes['dwg'] = 'drawing/dwg';
//add .zip
    $existing_mimes['zip'] = 'application/zip';

    return $existing_mimes;
}

add_filter('upload_mimes', 'custom_upload_mimes');
share|improve this question
    
Please explain "it doesn't seem to work". –  Brady Jul 6 '12 at 10:08

2 Answers 2

up vote 5 down vote accepted

Here is a action that works on my site:

add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
    // add your extension to the mimes array as below
    $existing_mimes['zip'] = 'application/zip';
    $existing_mimes['gz'] = 'application/x-gzip';
    return $existing_mimes;
}
share|improve this answer

If you are using WP MultiSite you can configure the behavior the following way (tested in WP 3.8.1):

  • Go to the network settings in your browser: http://example.com/wp-admin/network/settings.php
  • Scroll down to the bottom of the settings page and you will find a list of allowed file types, add zip to it.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.