Advertisements

wp_import_upload_form

Definition:
function wp_import_upload_form( $action ) {}

Outputs the form used by the importers to accept the data to be imported

Parameters

  • string $action: The action attribute for the form.

Defined filters

  • import_upload_size_limit
    apply_filters( 'import_upload_size_limit', wp_max_upload_size()

Source code

function wp_import_upload_form( $action ) {

	$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );

	$size = wp_convert_bytes_to_hr( $bytes );

	$upload_dir = wp_upload_dir();

	if ( ! empty( $upload_dir['error'] ) ) :

		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>

		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php

	else :

?>

<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr(wp_nonce_url($action, 'import-upload')); ?>">

<p>

<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)

<input type="file" id="upload" name="import" size="25" />

<input type="hidden" name="action" value="save" />

<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />

</p>

<?php submit_button( __('Upload file and import'), 'button' ); ?>

</form>

<?php

	endif;

}

3779

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: