title: How to view a file after uploading it to App_Data/Uploads in MVC 3 with Razor?
body: <p>I am new to mvc and I am stuck with a problem. I searched all over for an answer and I couldn't find one, but I am very sure that something skipped me. The problem is that I don't know how to acces a file after I upload it to App_Data folder. I use the same code that I found on all forums:</p>
  
  <p>For my view I use this </p>
  
  <pre><code>@using (Html.BeginForm("Index", "Home", FormMethod.Post, 
  new { enctype="multipart/form-data" }))
  {
  &lt;input type="file" name="file" /&gt;
  &lt;input type="submit" value="submit" /&gt;
  }
  </code></pre>
  
  <p>For my controller I use this </p>
  
  <pre><code>public class HomeController : Controller
  {
  // This action renders the form
  public ActionResult Index()
  {
      return View();
  }
  
  // This action handles the form POST and the upload
  [HttpPost]
  public ActionResult Index(HttpPostedFileBase file)
  {
      // Verify that the user selected a file
      if (file != null &amp;&amp; file.ContentLength &gt; 0) 
      {
          // extract only the fielname
          var fileName = Path.GetFileName(file.FileName);
          // store the file inside ~/App_Data/uploads folder
          var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
          file.SaveAs(path);
      }
      // redirect back to the index action to show the form once again
      return RedirectToAction("Index");        
    }
  } 
  </code></pre>
  
  <p>My model is </p>
  
  <pre><code>public class FileDescription
  {
      public int FileDescriptionId { get; set; }
      public string Name { get; set; }
      public string WebPath { get; set; }
      public long Size { get; set; }
      public DateTime DateCreated { get; set; }
  }
  </code></pre>
  
  <p>The thing is I want to upload a file to the database, and then the WebPath to be the link to my file. I hope I made myself clear enough. Any help would really be appreciated. 
  Thanks</p>