WordPress.org

Make WordPress Core

Changeset 7534


Ignore:
Timestamp:
03/26/2008 09:22:19 PM (10 years ago)
Author:
ryan
Message:

Fix user feedback when editing attachment details immediately after upload. Props andy. fixes #6398

File:
1 edited

Legend:

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

    r7533 r7534  
    204204
    205205    // Insert media button was clicked
    206     if ( !empty($_FILES) ) {
     206    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    207207        // Upload File button was clicked
    208208
     
    260260
    261261function media_upload_image() {
    262     if ( !empty($_FILES) ) {
     262    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    263263        // Upload File button was clicked
    264264        $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
     
    293293    }
    294294
     295    if ( isset($_POST['save']) )
     296        $errors['upload_notice'] = __('Saved.');
     297
    295298    return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
    296299}
    297300
    298301function media_upload_audio() {
    299     if ( !empty($_FILES) ) {
     302    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    300303        // Upload File button was clicked
    301304        $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
     
    328331    }
    329332
     333    if ( isset($_POST['save']) )
     334        $errors['upload_notice'] = __('Saved.');
     335
    330336    return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
    331337}
    332338
    333339function media_upload_video() {
    334     if ( !empty($_FILES) ) {
     340    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    335341        // Upload File button was clicked
    336342        $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
     
    363369    }
    364370
     371    if ( isset($_POST['save']) )
     372        $errors['upload_notice'] = __('Saved.');
     373
    365374    return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
    366375}
    367376
    368377function media_upload_file() {
    369     if ( !empty($_FILES) ) {
     378    if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
    370379        // Upload File button was clicked
    371380        $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
     
    397406            $errors = $return;
    398407    }
     408
     409    if ( isset($_POST['save']) )
     410        $errors['upload_notice'] = __('Saved.');
    399411
    400412    return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
     
    754766
    755767    // If Mac and mod_security, no Flash. :(
    756     $flash = true;
     768    $flash = false;
    757769    if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
    758770        $flash = false;
     
    762774?>
    763775<input type='hidden' name='post_id' value='<?php echo $post_id; ?>' />
     776<div id="media-upload-notice">
     777<?php if (isset($errors['upload_notice']) ) { ?>
     778    <?php echo $errors['upload_notice']; ?>
     779<?php } ?>
     780</div>
    764781<div id="media-upload-error">
    765782<?php if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) { ?>
     
    812829<div id="html-upload-ui">
    813830    <p>
    814     <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
     831    <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
    815832    </p>
    816833    <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />
Note: See TracChangeset for help on using the changeset viewer.