title: asp.net mvc file upload is passed as null to view model
body: <p>I have a form which uploads a photo to my database, and I use a view model to aid in this process. </p>
  
  <p>View Model:</p>
  
  <pre><code>public class GalleryViewModel
  {
      //Members:
      public Gallery _photo                { get; set; }
      public string _title                 { get; set; }
      public string _description           { get; set; }
      public string _photographer          { get; set; }
      public HttpPostedFileBase uploadFile { get; set; }
  
  
      // Ctor
      public GalleryViewModel(Gallery photo)
      {
          _photo = photo;
      }
  
      public GalleryViewModel()
      {
          _photo = null;
      }
  }
  </code></pre>
  
  <p>When I debug the code, I see that the in the post method in my controller, all the information from the form is updated in the view model except for the uploadFile which is null.
  In the form I use enctype = "multipart/form-data".  When I use my master page the uploadFile is null but when I use the default MVC master page everything works fine.</p>
  
  <p>Here is my master page:</p>
  
  <pre><code>&lt;%@ Master Language="C#" MasterPageFile="~/views/Shared/GeneralMaster.master" Inherits="System.Web.Mvc.ViewMasterPage" %&gt;
  </code></pre>
  
  <p>
      
  </p>
  
  <p></p>
  
  <pre><code>&lt;asp:Panel ID="notifiactions" runat="server"&gt;
     &lt;% if (ViewData["notifications"] != null)
     { %&gt;
          &lt;br /&gt;       
              &lt;table width="100%"&gt;
                  &lt;tr&gt;
                      &lt;td align="center"&gt;
                          &lt;div id="messages" style="width: 90%; border: solid 1px #A3A3A3"&gt;
                              &lt;br /&gt;     
                              &lt;%= Html.Encode(ViewData["notifications"])%&gt;                                
                              &lt;br /&gt;&lt;br /&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;   
     &lt;% } %&gt;    
  &lt;/asp:Panel&gt;
  
  &lt;br /&gt;
      &lt;table width="100%" cellpadding="0" cellspacing="0"&gt;
          &lt;tr&gt;
              &lt;td width="30%" align="center"&gt; 
                  &lt;img src="\Content\SiteDesign\wine_in_frame2.JPG" alt="lk" /&gt;
              &lt;/td&gt;
              &lt;td width="40%"&gt;
                  &lt;asp:ContentPlaceHolder ID="PageContent" runat="server" /&gt;
              &lt;/td&gt;  
              &lt;td width="30%" align="right"&gt; 
                  &lt;img src="\Content\SiteDesign\set_with_frame.jpg" alt="Alon" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;     
  </code></pre>
  
  <p></p>
  
  <p>Here is the default asp.net mvc master page</p>
  
  <pre><code>&lt;%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %&gt;
  </code></pre>
  
  <p>
  
  
      
       
      
  </p>
  
  <p>
      </p>
  
  <pre><code>    &lt;div id="header"&gt;
          &lt;div id="title"&gt;
              &lt;h1&gt;My MVC Application&lt;/h1&gt;
          &lt;/div&gt;
  
          &lt;div id="logindisplay"&gt;
              &lt;% Html.RenderPartial("LogOnUserControl"); %&gt;
          &lt;/div&gt; 
  
          &lt;div id="menucontainer"&gt;
  
              &lt;ul id="menu"&gt;              
                  &lt;li&gt;&lt;%= Html.ActionLink("Home", "Index", "Home")%&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;%= Html.ActionLink("About", "About", "Home")%&gt;&lt;/li&gt;
              &lt;/ul&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="main"&gt;
          &lt;asp:ContentPlaceHolder ID="MainContent" runat="server" /&gt;
  
          &lt;div id="footer"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Any Ideas?</p>