title: MVC3 How to check if HttpPostedFileBase is an image
body: <p>I have a controller like this:</p>
  
  <pre><code>public ActionResult Upload (int id, HttpPostedFileBase uploadFile)
  {
  ....
  }
  </code></pre>
  
  <p>How can I make sure that uploadFile is an image (jpg, png etc.)</p>
  
  <p>I have tried with</p>
  
  <pre><code>using (var bitmapImage = new Bitmap (uploadFile.InputStream)) {..}
  </code></pre>
  
  <p>which throws an ArgumentException if bitmapImage can not be created. </p>
  
  <p>Is there a better way for example by looking at uploadFile.FileName?</p>