title: jQuery $.post sending image file to servlet
body: <p>I have <code>javaee</code> project. I want to send image file to my servlet via ajax.
  Ajax not sending image file to my java class. But it is sending textarea value.
  Here is my form</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" beanclass="ActionBean"&gt;
      &lt;input type="file" id="uploadFile" name="newAttachment"/&gt;
      &lt;textarea name="name" id="name" rows="2" cols="30"&gt;&lt;/textarea&gt;
      &lt;s:submit value="Edit" name="saveOfferInfo" onclick="return edit(this);" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>JavaScript function:</p>
  
  <pre><code>function edit(button) {
      var form = button.form;
      var params = $(form).serializeArray();
      params.push({name: '_eventName', value: button.name});
      $.post(form.action, params, function (data) {
          alert("success");
  });
  </code></pre>