title: ASP.NET MVC 4 C# HttpPostedFileBase, How do I Store File
body: <p><strong>Model</strong></p>
  
  <pre><code>public partial class Assignment
  {
      public Assignment()
      {
          this.CourseAvailables = new HashSet&lt;CourseAvailable&gt;();
      }
  
      public string AssignmentID { get; set; }
      public Nullable&lt;System.DateTime&gt; SubmissionDate { get; set; }
      public string Status { get; set; }
      public Nullable&lt;decimal&gt; Mark { get; set; }
      public string Comments { get; set; }
      public string FileLocation  { get; set; }
      public virtual ICollection&lt;CourseAvailable&gt; CourseAvailables { get; set; }
  }}
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code> public ActionResult Create(Assignment assignment)
      {
          if (ModelState.IsValid)
          {
  
  
              db.Assignments.Add(assignment);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          return View(assignment);
      }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;div class="editor-field"&gt;
      &lt;%: Html.TextBoxFor(model =&gt; model.FileLocation, new { type="file"})%&gt;
      &lt;%: Html.ValidationMessageFor(model =&gt; model.FileLocation) %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I store a file if I wanted to store the file into the server/path folder and in the database I only want to store the Path name/string.</p>