title: Upload file using ajax calls
body: <p>I looked through multiple tutorials, but none of it helps.
  I have page with 4 controls and with tab-panel bootstrap theme. 
  In code-behind of the page I want to save file that I uploaded:</p>
  
  <pre><code>    [WebMethod]
      public static string UploadFile()
      {
          try
          {
              var file = HttpContext.Current.Request.Files["file"];
              var filName = Path.GetFileName(file.FileName);
              var filePlace = HttpContext.Current.Server.MapPath("Uppladdat") + "\\" + filName;
              file.SaveAs(filePlace);
              return filePlace;
  
          }
          catch (Exception)
          {
              return "";
          }
      }
  </code></pre>
  
  <p>And for ajax request I use that code:</p>
  
  <pre><code>  function uploadFileAjax(file) {
  
              var formData = new FormData(file);
            //  formData.append("file", file);
              $.ajax({
                  url: 'Wizard.aspx/UploadFile',
                  type: 'POST',
                  data: formData,
                  cache: false,
                  processData: false, // Don't process the files
                  contentType: false, // Set content type to false as jQuery will tell the server its a query string request
                  enctype: 'multipart/form-data',
                  success: function (response) {
                      console.log(response);
                  },
                  error: function (errorThrown) {
                      // Handle errors here
                      console.log('ERRORS: ' + errorThrown);
                      // STOP LOADING SPINNER
                  }
              });
  
          }
  </code></pre>
  
  <p>It returns to me successful result with page html except one string that I need so much.Also I tried to do some job with update panel, but it refreshes all the page:</p>
  
  <pre><code>&lt;asp:ScriptManager ID="sm1" runat="server"&gt;&lt;/asp:ScriptManager&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"&gt;
          &lt;ContentTemplate&gt;
              &lt;div class="col-sm-3"&gt;
                  &lt;input id="uppladdadFil" type="file" name="uppladdadFil" runat="server" /&gt;
              &lt;/div&gt;
              &lt;div class="col-sm-4"&gt;
                  &lt;input id="Submit1" class="btn btn-default" type="submit" value="Bifoga" name="Submit1" runat="server" onserverclick="Submit1_ServerClick" /&gt;
                  &lt;input type="hidden" name="HiddenField1" id="HiddenField1" runat="server" /&gt;
              &lt;/div&gt;
              &lt;div class="row top10"&gt;
                  &lt;div class="col-sm-6"&gt;
                      &lt;asp:Label ID="lblFilFelmeddelande" CssClass="label    label-danger" runat="server" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/ContentTemplate&gt;
          &lt;Triggers&gt;
              &lt;asp:PostBackTrigger ControlID="Submit1" /&gt;
          &lt;/Triggers&gt;
      &lt;/asp:UpdatePanel&gt;
  </code></pre>
  
  <p>Will be appreciated for any help to resolve that task.</p>