media_upload_form example

$form_class .= ' html-uploader';
    }

    ?> <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form"> <?php submit_button( '', 'hidden', 'save', false ); ?> <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" /> <?php wp_nonce_field( 'media-form' ); ?> <h3 class="media-title"><?php _e( 'Add media files from your computer' ); ?></h3> <?php media_upload_form( $errors ); ?> <script type="text/javascript"> jQuery(function($){ var preloaded = $(".media-item.preloaded"); if ( preloaded.length > 0 ) { preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); } updateMediaForm(); }); </script> <div id="media-items">
$form_class = 'media-upload-form type-form validate';

if ( get_user_setting( 'uploader' ) || isset( $_GET['browser-uploader'] ) ) {
    $form_class .= ' html-uploader';
}
?> <div class="wrap"> <h1><?php echo esc_html( $title ); ?></h1> <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( admin_url( 'media-new.php' ) ); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form"> <?php media_upload_form(); ?> <script type="text/javascript"> var post_id = <?php echo absint( $post_id ); ?>, shortform = 3; </script> <input type="hidden" name="post_id" id="post_id" value="<?php echo absint( $post_id ); ?>" /> <?php wp_nonce_field( 'media-form' ); ?> <div id="media-items" class="hide-if-no-js"></div> </form> </div> <?php
Home | Imprint | This part of the site doesn't use cookies.