title: JQuery Ajax uploading a file and other values from client side
body: <p>I need to upload a file to the server and send a GUID value, both needed to complete an operation.</p>
  
  <p>Is it possible to send both with one <code>$.ajax</code> statement?</p>
  
  <p>Here's a snippet of the Upload action method I'm using</p>
  
  <pre><code>[HttpPost]
  public ActionResult Upload()
  {
    HttpPostedFileBase file = Request.Files[0];
  }
  </code></pre>
  
  <p>and here's a snippet of the Javascript code I'm using to send the file to the server</p>
  
  <pre><code>function upload() {
    var formData = new FormData();
    var totalFiles = document.getElementById("FileUpload").files.length;
  
    for (var i = 0; i &lt; totalFiles; i++) {
      var file = document.getElementById("FileUpload").files[i];
  
      formData.append("FileUpload", file);
    }
  
    $.ajax({
      type: 'post',
      url: '/myController/Upload',
      data: formData,
      dataType: 'json',
      contentType: false,
      processData: false,
      success: function (response) {
        alert('succes!!');
      },
      error: function (error) {
        alert("errror");
      }
    });
  }
  </code></pre>
  
  <p>This code is working well. The file is uploaded as expected but now I need to send a <code>GUID</code> to the same controller (Upload) so I wonder if I can send the GUID with the file in the same <code>$.ajax</code> statement?</p>