WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/16/2016 03:38:12 PM (5 years ago)
Author:
ocean90
Message:

Media: Pass allowed file extensions to Plupload.

Plupload's mime_types filter (http://www.plupload.com/docs/Options#filters.mime_types) allows us to inform a user about an unsupported file before the file gets uploaded.

Props polevaultweb.
Fixes #14244.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r37560 r37727  
    29192919
    29202920/**
    2921  * Prints default plupload arguments.
     2921 * Prints default Plupload arguments.
    29222922 *
    29232923 * @since 3.4.0
     
    29312931
    29322932    $max_upload_size = wp_max_upload_size();
     2933    $allowed_extensions = array_keys( get_allowed_mime_types() );
     2934    $extensions = array();
     2935    foreach ( $allowed_extensions as $extension ) {
     2936        $extensions = array_merge( $extensions, explode( '|', $extension ) );
     2937    }
    29332938
    29342939    $defaults = array(
     
    29402945        'filters' => array(
    29412946            'max_file_size'   => $max_upload_size . 'b',
     2947            'mime_types'      => array( array( 'extensions' => implode( ',', $extensions ) ) ),
    29422948        ),
    29432949    );
Note: See TracChangeset for help on using the changeset viewer.