diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php index 678df7921b..04295dabd6 100644 --- a/src/wp-admin/includes/media.php +++ b/src/wp-admin/includes/media.php @@ -1760,7 +1760,7 @@ $post_params = array( $post_params = apply_filters( 'upload_post_params', $post_params ); $plupload_init = array( - 'runtimes' => 'html5,silverlight,flash,html4', + 'runtimes' => 'html5,flash,silverlight,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', diff --git a/src/wp-includes/js/plupload/handlers.js b/src/wp-includes/js/plupload/handlers.js index b7d77dc7bf..2140f0f5df 100644 --- a/src/wp-includes/js/plupload/handlers.js +++ b/src/wp-includes/js/plupload/handlers.js @@ -400,6 +400,16 @@ jQuery(document).ready(function($){ // init and set the uploader uploader_init = function() { + var isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1; + + // Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode) + if ( ! isIE && 'flash' === plupload.predictRuntime( wpUploaderInit ) && + ( ! wpUploaderInit.required_features || ! wpUploaderInit.required_features.hasOwnProperty( 'send_binary_string' ) ) ) { + + wpUploaderInit.required_features = wpUploaderInit.required_features || {}; + wpUploaderInit.required_features.send_binary_string = true; + } + uploader = new plupload.Uploader(wpUploaderInit); $('#image_resize').bind('change', function() { @@ -430,8 +440,9 @@ jQuery(document).ready(function($){ $('#drag-drop-area').unbind('.wp-uploader'); } - if ( up.runtime == 'html4' ) + if ( up.runtime === 'html4' ) { $('.upload-flash-bypass').hide(); + } }); uploader.init(); diff --git a/src/wp-includes/js/plupload/wp-plupload.js b/src/wp-includes/js/plupload/wp-plupload.js index d8476caffd..9f7262c241 100644 --- a/src/wp-includes/js/plupload/wp-plupload.js +++ b/src/wp-includes/js/plupload/wp-plupload.js @@ -25,6 +25,7 @@ window.wp = window.wp || {}; */ Uploader = function( options ) { var self = this, + isIE = navigator.userAgent.indexOf('Trident/') != -1 || navigator.userAgent.indexOf('MSIE ') != -1, elements = { container: 'container', browser: 'browse_button', @@ -85,6 +86,14 @@ window.wp = window.wp || {}; return; } + // Make sure flash sends cookies (seems in IE it does whitout switching to urlstream mode) + if ( ! isIE && 'flash' === plupload.predictRuntime( this.plupload ) && + ( ! this.plupload.required_features || ! this.plupload.required_features.hasOwnProperty( 'send_binary_string' ) ) ) { + + this.plupload.required_features = this.plupload.required_features || {}; + this.plupload.required_features.send_binary_string = true; + } + this.uploader = new plupload.Uploader( this.plupload ); delete this.plupload; diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index f038c39838..23fdbc0bcc 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2176,7 +2176,7 @@ function wp_plupload_default_settings() { $max_upload_size = wp_max_upload_size(); $defaults = array( - 'runtimes' => 'html5,silverlight,flash,html4', + 'runtimes' => 'html5,flash,silverlight,html4', 'file_data_name' => 'async-upload', // key passed to $_FILE. 'url' => admin_url( 'async-upload.php', 'relative' ), 'flash_swf_url' => includes_url( 'js/plupload/Moxie.swf' ),