Jump to content

admin-bar.php conflict with file upload


jrunk

Recommended Posts

I added a file upload option to the contact form and it works perfectly when I comment out <?php wp_footer(); ?> from the footer.php

 

I'm assumed the admin bar search form caused a conflict, so I included the enctype="multipart/form-data" code to the form like this;

 

admin-bar.php
$form  = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch" enctype="multipart/form-data" >';
$form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
$form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
$form .= '</form>';
 
When I include the admin bar, the $_FILES array returns back empty and I can't figure out why.  This is a custom template so I viewed source from the browser to see if I was missing a form, but no luck.  There are other forms, but all from my contact form, which works without the admin bar.
 
This is Wordpress 3.5.1 running on a GoDaddy environment.
 
Ideas?
Link to comment
Share on other sites

The type on the contact form is type="file", but I dont want to change the other search forms input types.  One is a search from the admin bar at the top and the other is a search form nested in the header of the page.  

Link to comment
Share on other sites

I dont believe its the search form from the admin-bar.php page anymore because I commented out the entire function.  The search box disappeared from the right side of the admin bar, but the $_FILES array is still null.  Theres a conflict somewhere, but I'm not sure what would cause grief from the admin-bar.php page?

 

 

/**
 * Add search form.
 *
 * @since 3.3.0
 */
//function wp_admin_bar_search_menu( $wp_admin_bar ) {
// if ( is_admin() )
// return;
 
// $form  = '<form enctype="multipart/form-data" action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch" >';
// $form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
// $form .= '<input type="submit" class="adminbar-button" value="' . __('Search') . '"/>';
// $form .= '</form>';
 
// $wp_admin_bar->add_menu( array(
// 'parent' => 'top-secondary',
// 'id'     => 'search',
// 'title'  => $form,
// 'meta'   => array(
// 'class'    => 'admin-bar-search',
// 'tabindex' => -1,
// )
// ) );
//}
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.