title: Mvc Ajax begin form with file upload get error?
body: <p>I using mvc ajax begin form , when i try file upload . I get error as <code>VM454:1 Uncaught SyntaxError: Unexpected token u</code> in chrome. This is code snippet</p>
  
  <hr>
  
  <p><strong>partialView Info.cshtml</strong></p>
  
  <pre><code>@using (Ajax.BeginForm("ChangeInfo", "Users",
          new AjaxOptions
          {
              HttpMethod = "Post",
              InsertionMode = InsertionMode.Replace,
              UpdateTargetId = "tab1-item2"
          },
          new { enctype = "multipart/form-data" }
      ))
      {
          @Html.AntiForgeryToken()
          @Html.ValidationSummary(true, "", new { @class = "text-validate" })
          &lt;img id="img1" src= "@Html.DisplayFor(model =&gt; model.Image)"  class="img-thumbnail" /&gt;
          &lt;input id="imgInp" name="file" type="file" /&gt;      
          &lt;label&gt;FullName&lt;/label&gt;
          &lt;h6 style="color: red"&gt;@Html.ValidationMessageFor(p =&gt; p.FullName)&lt;/h6&gt;
          @Html.TextBoxFor(p =&gt; p.FullName, new { @class = "form-control", @maxlength = "50" })
          &lt;button type="submit" id="bt_change_info"&gt;Change&lt;/button&gt;    
      }
  </code></pre>
  
  <hr>
  
  <p><strong>View Index.cshtml</strong></p>
  
  <pre><code> &lt;div class="tab-pane fade" id="tab1-item2"&gt;
        @Html.Action("PVInfo", "Users")
   &lt;/div&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>And controller User</strong></p>
  
  <pre><code>public PartialViewResult PVInfo() {
    var UserID = (Session["CurrentUser"] as USER).USER_ID;
    var user_info = (from users in db.USERS where users.USER_ID == UserID select new UserInfoModel {
                     FullName = users.FULL_NAME,
                     Image = users.IMAGE,
                     }).FirstOrDefault();
    return PartialView("Info", user_info);
  }
  
  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult ChangeInfo(UserInfoModel model, HttpPostedFileBase file) {
    var UserID = (Session["CurrentUser"] as USER).USER_ID;
    USER userinfo = db.USERS.Where(e =&gt; e.USER_ID == UserID &amp;&amp; e.FLAG == true).FirstOrDefault();
    if (ModelState.IsValid) {
      userinfo.FULL_NAME = model.FullName;
      db.SaveChanges();
      if (file != null &amp;&amp; file.ContentLength &gt; 0) {
        //var fileName = Path.GetFileName(file.FileName);
        var fileName = UserID + ".PNG";
        var path = Path.Combine(Server.MapPath("~/User_IMG"), fileName);
        file.SaveAs(path);
      }
      return PartialView("Info", model);
    } else
      return PartialView("Info", model);
  }
  </code></pre>
  
  <p>What the issue in here ? Can you tell me some mistake or wrong ? and give me some advices , or use jquery ajax submit form </p>
  
  <pre><code>$("#idForm").submit(function() {
      //var formData = new FormData($(this)[0]);
      $.ajax({
          url: "/Users/ChangeInfo",
          type: "POST",
          //data: formData,
          //async: false,
          cache: false,
          contentType: html,
          //proccessData: false,
          success: function(result) {
              // do something smart here
          }
      });
  });
  </code></pre>