Why IEnumerable<HttpPostedFileBase> count is 1 when I upload 0 files?
问题 I have a multiple upload form and I want to check if there is any files when I launch the upload. Here is my code. View : @using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data"})) { <input name="files" type="file" multiple="multiple" /> <input type="submit" value="Upload" /> } Controller : [HttpPost] public ActionResult Upload(IEnumerable<HttpPostedFileBase> files) { if (files.Count() > 0) Console.WriteLine(files.Count()); // display 1 if(files.Any())