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

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');

3 s
3

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;
}

Leave a Comment