title: DownloadFile in ASP mvc 4 from physical path
body: <p>I need to make downloading files from the server . Server is specified physical path.
  the file is downloaded , but there are problems that I do not know how to fix .
  1) All the files are named as "Download".2) does not have an extension . Help me, please, I'm new to ASP MVC</p>
  
  <p>Code of Controller :</p>
  
  <pre><code>        public ActionResult NIRInfo()
      {
          List&lt;string&gt; filesList = new List&lt;string&gt;();
          var dir = new System.IO.DirectoryInfo(@"Z:\Docs");
          System.IO.FileInfo[] fileNames = dir.GetFiles("*.*");
          var xow = from i in db.NIRs where i.Id == id select i.File;
          foreach (var i in xow)
          {
              fileNames = dir.GetFiles(i);
              foreach (var f in fileNames)
              {
                  filesList.Add(f.Name);
              }
              ViewData["fList"] = filesList;
          }
          return View(nir);
  
      }
  
      public FileResult Download(string Name)
      {
          return File(@"Z:\Docs\" + Name,  MediaTypeNames.Application.Octet);
      }
  </code></pre>
  
  <p>Code of view</p>
  
  <pre><code>                            @{ var fList = ViewData["fList"] as List&lt;string&gt;;}
  
                          @if (ViewData["fList"] != null)
                          {
                              &lt;table&gt;
                                  @foreach (var f in fList)
                                  {
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;a href="@Url.Action("Download", "NIR", new {  Name = @f })"&gt;@f&lt;/a&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                  }
                              &lt;/table&gt;
                          }
  </code></pre>