title: File Upload ASP.NET MVC
body: <p>Basically what I have at the moment is a ASP.NET MVC project made database first the tables take alpha numeric input but I think it would be pretty nifty to have a file upload so I can insert a picture into the database so I created a table in SQL server with an ID field and an image field with the data type image. </p>
  
  <p>When i add this model and create my controller and views based on that model it doesn't create the label or editor for this field, I used DataAnnotations to give it the DataType upload but I can't find a way of actually uploading the file I tried this which works for normal input but nothing shows up is there a way of having a @HTML.FileUploadFor(model => model.Vehicle) or something along those lines.</p>
  
  <p>This is what I've tried</p>
  
  <pre><code>&lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Vehicle)
  &lt;/div&gt;
  &lt;div class="editor-field"&gt;
      @Html.EditorFor(model =&gt; model.Vehicle)
      @Html.ValidationMessageFor(model =&gt; model.Vehicle)
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my model</p>
  
  <pre><code>public partial class VehicleImage
  {
      public int Vehicle_ID { get; set; }
      [DataType(DataType.Upload)]
      public byte[] Vehicle { get; set; }
  }
  </code></pre>