Make WordPress Core

Changeset 7682


Ignore:
Timestamp:
04/14/2008 11:09:14 PM (19 years ago)
Author:
ryan
Message:

Workaround response truncation by reducing size of response after uploading with flash uploader. Props tellyworth. fixes #6713

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/async-upload.php

    r6830 r7682  
    2121        wp_die(__('You do not have permission to upload files.'));
    2222
     23// just fetch the detail form for that attachment       
     24if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
     25        echo get_media_item($id);
     26        exit;
     27}
     28
    2329$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
    2430if (is_wp_error($id)) {
    … …  
    2733}
    2834
    29 $type = $_REQUEST['type'];
    30 echo apply_filters("async_upload_{$type}", $id);
     35if ( $_REQUEST['short'] ) {
     36        // short form response - attachment ID only
     37        echo $id;
     38}
     39else {
     40        // long form response - big chunk o html
     41        $type = $_REQUEST['type'];
     42        echo apply_filters("async_upload_{$type}", $id);
     43}
    3144
    3245?>
  • trunk/wp-admin/includes/media.php

    r7677 r7682  
    805805                                "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
    806806                                "type" : "<?php echo $type; ?>",
    807                                 "tab" : "<?php echo $tab; ?>"
     807                                "tab" : "<?php echo $tab; ?>",
     808                                "short" : "1"
    808809                        },
    809810                        file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
  • trunk/wp-includes/js/swfupload/handlers.js

    r7677 r7682  
    3636        jQuery('#media-item-' + fileObj.id + ' .progress').hide();
    3737
    38         // Append the HTML returned by the server -- thumbnail and form inputs
    39         jQuery('#media-item-' + fileObj.id).append(serverData);
     38        // Old style: Append the HTML returned by the server -- thumbnail and form inputs
     39        if ( isNaN(serverData) || !serverData ) {
     40                jQuery('#media-item-' + fileObj.id).append(serverData);
     41                prepareMediaItemInit(fileObj);
     42        }
     43        // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
     44        else {
     45                jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:1}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
     46        }
     47}
     48               
     49function prepareMediaItemInit(fileObj) {
    4050
    4151        // Clone the thumbnail as a "pinkynail" -- a tiny image to the left of the filename
  • trunk/wp-includes/script-loader.php

    r7679 r7682  
    8888                ) );
    8989                $this->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2.0.2');
    90                 $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080331');
     90                $this->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
    9191                // these error messages came from the sample swfupload js, they might need changing.
    9292                $this->localize( 'swfupload-handlers', 'swfuploadL10n', array(
Note: See TracChangeset for help on using the changeset viewer.