title: Fetching Fileupload value from FormCollection values in mvc
body: <p>I am trying to check if the file is selected in the fileupload in mvc  using Form collection  but the formvalues is always null , fileupload is not passing the uploaded file name to formcollection , below is the code:</p>
  
  <pre><code>   public ActionResult Create(FormCollection formValues,IEnumerable&lt;HttpPostedFileBase&gt; files, Venue venue)
      {
          string[] images = { "", "" };
          int i = 0;
       //   string smallImage;
        //  string largeImage;
          foreach (HttpPostedFileBase file in files)
          {
              if (file != null)
              {
                  if (i == 0)
                  {
  
                      string newFileName = string.Format("{0}{1}", Guid.NewGuid().ToString(), Path.GetExtension(file.FileName));
                      var fileName = Path.GetFileName(file.FileName);
                      var path = Path.Combine(Server.MapPath("~/Content/images/content/"), fileName);
                      file.SaveAs(path);
                      Helpers.ImageHelpers.ResizeImage(newFileName, path, "/Content/images/content/", 162, 105);
                      images[0] = newFileName;
                      venue.ImageSmall = images[0];
                  //    smallImage = "selected";
                  }
  
                  if (i == 1)
                  {
  
                      string newFileName = string.Format("{0}{1}", Guid.NewGuid().ToString(), Path.GetExtension(file.FileName));
                      var fileName = Path.GetFileName(file.FileName);
                      var path = Path.Combine(Server.MapPath("~/Content/images/content/"), fileName);
                      file.SaveAs(path);
                      Helpers.ImageHelpers.ResizeImage(newFileName, path, "/Content/images/content/", 212, 240);
                      images[1] = newFileName;
                      venue.ImageLarge = images[1];
                   //   largeImage = "selected";
                  }
  
              }
              i++;
          }
  
          if (string.IsNullOrEmpty(formValues["files1"]) || string.IsNullOrEmpty(formValues["files2"])  )
          {
  
              ModelState.AddModelError("files", "Please upload a file");
          }
  
        &lt;td&gt;
                          &lt;div class="editor-field"&gt;
                              &lt;input type="file" name="files" id="files1" style="color:White" /&gt;
  
  
                              &lt;/div&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              Detail Image
                          &lt;/td&gt;
                          &lt;td&gt;
                          &lt;div class="editor-field"&gt;
                              &lt;input type="file" name="files" id="files2" style="color:White"/&gt;
  
  
                              &lt;/div&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ZzasH.jpg" alt="In the keys section there is no formvalue[&quot;files&quot;]"></p>