File upload using jquery not working
<p>I'm trying to make a really simple file upload using jQuery, without having to download 3rd party plugin / scripts.</p>

<p>Here is my code:</p>

<p>HTML  </p>

<pre><code>  &lt;form enctype="multipart/form-data" action="" method="POST" name="form"&gt;
    &lt;input type="hidden" name="MAX_FILE_SIZE" value="1000000" /&gt;
    &lt;?php _e('Choose a file to upload') ?&gt;: &lt;input name="uploadedfile" class="uploadedFile" type="file" /&gt;
    &lt;input type="submit" class="button uploadImage" value="&lt;?php _e('Upload File') ?&gt;" /&gt;
  &lt;/form&gt;
</code></pre>

<p>PHP</p>

<pre><code>&lt;?php
  require_once($_SERVER['DOCUMENT_ROOT'].'/wp-blog-header.php');

  $uploaddir = WP_CONTENT_URL.'/uploads'.$_POST['current_path'];
  $uploaddir = str_replace('/','\\', $uploaddir);
  $uploadfile = $uploaddir .'\\'. basename($_FILES['uploadedfile']['name']);


  echo $uploadfile;
?&gt;
</code></pre>

<p>JS</p>

<pre><code>  //File upload
  jQuery('.uploadImage').live('click',function() {

    var current_path = jQuery('#currentPath span').html();
    var new_dir = jQuery(this).find('span').html();

    // Load new content in browser window
    jQuery.ajax({
        type: "POST",
        url: "../wp-content/plugins/wp-filebrowser/uploader.php",
        dataType: 'html',
        data: {current_path: current_path, new_dir: new_dir},

        success: function(data){
                 alert(data);
        },

        error: function(){
          alert('Page load failed.');
        }
    });

  });
</code></pre>

<p>The problem is that I can't get info on <code>$_FILES['uploadedfile']['name']</code>. Is this because the form is never submitted?</p>
