title: Passing Image to Controller ASP.NET MVC
body: <p>I am trying to send Image and ImageName from View to Controller.</p>
  
  <p>Here's how my controller looks:</p>
  
  <pre><code>  [HttpPost]
    public ActionResult Add(BoxAddViewModel image)
    {
        //TODO: Add new box
        return RedirectToAction("Index");
    }
  </code></pre>
  
  <p>This is the model:</p>
  
  <pre><code> public class BoxAddViewModel : BaseViewModel
   {
       public int Id { get; set; }
       [Required]
       [DisplayName("Name")]
       public string Name { get; set; }
       [Required]
       [DisplayName("Source")]
       public HttpPostedFileBase Source { get; set; }
  
   }
  </code></pre>
  
  <p>And finally the view:</p>
  
  <pre><code>@using (Html.BeginForm("Add", "BoxManagement", new { @class = "form-horizontal", enctype = "multipart/form-data" }))
  {
  
      &lt;div class="form-group"&gt;
          @Html.LabelFor(m =&gt; m.Name, new { @class = "col-sm-2 control-label" })
          &lt;div class="col-sm-10"&gt;
              @Html.TextBoxFor(m =&gt; m.Name, new { @class = "form-control", @name = "Name"})
              @Html.ValidationMessageFor(m =&gt; m.Name)
          &lt;/div&gt;
          @Html.LabelFor(m =&gt; m.Source, new { @class = "col-sm-2 control-label" })
          &lt;div class="col-sm-10"&gt;
              &lt;!--Html.TextBoxFor(m =&gt; m.Source, new { type = "file",}) --&gt;
              @Html.ValidationMessageFor(m =&gt; m.Source)
              &lt;input type="file" name="Source" id="Source" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;button type="submit" class="btn btn-primary"&gt;&lt;span class="glyphicon glyphicon-plus"&gt;&lt;/span&gt;Add&lt;/button&gt;
      @Html.ActionLink("Cancel", "Index", null, new { @class = "btn btn-default" })
  }
  </code></pre>
  
  <p>It comes into the Add method and the Name property value is correct but the Source is null.</p>
  
  <p>Anyone know how to solve this?</p>