title: JQuery - upload file with $.ajax
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2320069/jquery-ajax-file-upload">jQuery Ajax File Upload</a>  </p>
  </blockquote>
  
  
  
  <p>i want to upload a file using php and during the upload i want to show a loader to the user. Afterwards one div should be changed, and therefore i thought jQuery will be the right choice. </p>
  
  <p>I tried it with this method, but it is not working properly:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="pop_layerbody"&gt;
  &lt;form action="javascript:;" method="post" enctype="multipart/form-data" onSubmit="jsUploadFile();"&gt;
  &lt;input name="bild" id="bild" type="file" size="50" maxlength="100000"&gt;
  &lt;input type="submit" value="Hochladen" id="button_upload"&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JavaScript/JQuery:</p>
  
  <pre><code>function jsUploadFile() {
      $('#pop_layerbody').html('&lt;img src="../includes/images/ajax-loader-big.png" style="margin-top:35px;" /&gt;');
      $.ajax({
          type: "POST",
          url: "upload_picture_logic.php",
      }).done(function (msg) {
          alert("Data Saved: " + msg);
      });
  }
  </code></pre>
  
  <p>PHP: (excerpt)</p>
  
  <pre><code>@move_uploaded_file($_FILES['bild']['tmp_name'], "upload/".$_FILES['bild']['name']);
  </code></pre>
  
  <p>Anybody know the answer? It seems that even the POST-combination between HTML and JS is not working...</p>