WordPress.org

Make WordPress Core

Changeset 7683


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

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

Location:
branches/2.5
Files:
4 edited

Legend:

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

    r6830 r7683  
    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?>
  • branches/2.5/wp-admin/includes/media.php

    r7676 r7683  
    802802                "auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
    803803                "type" : "<?php echo $type; ?>",
    804                 "tab" : "<?php echo $tab; ?>"
     804                "tab" : "<?php echo $tab; ?>",
     805                "short" : "1"
    805806            },
    806807            file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
  • branches/2.5/wp-includes/js/swfupload/handlers.js

    r7676 r7683  
    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
  • branches/2.5/wp-includes/script-loader.php

    r7678 r7683  
    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.