title: upload a file and save it in a temporary folder
body: <p>I have the following method that uploads a file:</p>
  
  <pre><code>[HttpPost]
      public ActionResult Upload()
      {
  
          string directory = @"C:\Temp\";
  
          HttpPostedFileBase file = Request.Files["file"];
  
          if (file != null &amp;&amp; file.ContentLength &gt; 0)
          {
              var fileName = Path.GetFileName(file.FileName);
  
              file.SaveAs(Path.Combine(directory, fileName));
          }
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>and here is my ajax call:</p>
  
  <pre><code>$('#uploadButton').on('click', function()
  {
  
      $.ajax({
          type: "POST",
          dataType: 'json',
          url: '@Url.Action("Upload", "Application")',
          timeout: 2000,
          contentType: 'application/json',
          success: function (data) {
  
              //show content
              alert('Success!')
          }
      });
  }
  )
  </code></pre>
  
  <p>I need to send the "Request.files["file"]" with the uploaded file.</p>
  
  <p>Here is the form where my code is located :</p>
  
  <pre><code>&lt;form action="/profile/upload" method="post" enctype="multipart/form-data"&gt;
  
      &lt;div class="form-group"&gt;
  
          &lt;label&gt;File&lt;/label&gt;
  
          &lt;input type="file" name="file" id="file" class="form-control" /&gt;
          &lt;br /&gt;
          &lt;input type="button" id="uploadButton" value="Upload" /&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>