title: File is not uploading in ASP.Net MVC
body: <p>Hi to all of you I am facing a problem on uploading a file and saving it into a folder here is my view</p>
  
  <pre><code>&lt;div class="admin-empty-dashboard"&gt;
  @using (Html.BeginForm("UploadResumes", "Employee", new { enctype = "multipart/form-data" }))
  {
  
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
      &lt;div class="icon"&gt;
          &lt;i class="ion-ios-book-outline"&gt;&lt;/i&gt;
      &lt;/div&gt;
  
      &lt;h4&gt;Welcome @Model.FullName!&lt;/h4&gt;
      &lt;p&gt;@ViewBag.Error&lt;/p&gt;
      &lt;div class="form-group bootstrap-fileinput-style-01"&gt;
          &lt;label&gt;Upload Resume&lt;/label&gt;
          &lt;input type="file" name="file" required="required" class="btn btn-primary" style="margin-left:265px" accept="application/msword,text/plain, application/pdf"&gt;
          &lt;span class="font12 font-italic"&gt;** File must not bigger than 2MB&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;input type="submit" name="name" class="btn btn-primary" value="UploadResumes" /&gt;
  }
  
  &lt;/div&gt;
  </code></pre>
  
  <p>and here is my controllers action problem is that it HttpPostedFileBase object value is always null and i ran Request.Files.Count it's also giving me zero where is problem?  </p>
  
  <pre><code>public ActionResult UploadResumes(HttpPostedFileBase file)
  {
      if (Session["UserID"] != null &amp;&amp; Session["UserName"] != null &amp;&amp; Session["EmployeeID"] != null)
      {
          int id = Convert.ToInt32(Session["EmployeeID"]);
          string[] allowedExtenssions = new string[] { ".pdf", ".doc", ".docx" };
          string cvPath = "~/cvs/Employee_cvs/";
          if (!Directory.Exists(Server.MapPath(cvPath)))
              Directory.CreateDirectory(Server.MapPath(cvPath));
  
          MyDbContext db=new MyDbContext();
          tblEmployee employee = (from s in db.tblEmployees where s.UserId == id select s).FirstOrDefault();
  
          // HttpPostedFileBase cv = Request.Files["CV"];
          if (file != null)
          {
              if (file.ContentLength &gt; 0)
              {
  
                  string ext = Path.GetExtension(file.FileName);
                  if (allowedExtenssions.Contains(ext.ToLower()))
                  {
                      string fileName = DateTime.Now.Ticks + ext;
                      string filePath = cvPath + fileName;
                      string serverPath = Server.MapPath(filePath);
                      file.SaveAs(serverPath);
                      employee.cvUrl = filePath;
                  }
  
              }
              ViewBag.Error = "Some Error Occured";
          }
  
          return RedirectToAction("Dashboard");
  
      }
      else
      {
          return RedirectToAction("Login", "User");
      }
  }
  </code></pre>