title: ASP.Net MVC image upload failing in Google Chrome
body: <p>I have an image upload form </p>
  
  <pre><code>&lt;% using (Html.BeginForm("PictureValidateAndSave", "UserGallery", new {}, FormMethod.Post, new { enctype = "multipart/form-data"})) { %&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt; Album Name: &lt;/td&gt;
              &lt;td&gt; &lt;%= Html.DropDownList("albumList") %&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt; File Location: &lt;/td&gt; 
              &lt;td&gt; &lt;input type="file" name="picture" accept="image/gif, image/jpeg" /&gt; &lt;/td&gt;  
          &lt;tr&gt;
          &lt;tr&gt;
              &lt;td&gt; Picture name: &lt;/td&gt;
              &lt;td&gt; &lt;input name="pictureName" style="width: 147px;"/&gt; &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;            
      &lt;p&gt; &lt;input type="submit" value="Save" /&gt; &lt;/p&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>That posts back to the action</p>
  
  <pre><code>public ActionResult PictureValidateAndSave(long albumList, HttpPostedFileBase picture, string pictureName)
  </code></pre>
  
  <p>The code works accross all browsers but Google Chrome. My IDE is Visual Studio 2k8, and I haven't figured out how to debug on Google Chrome with it, however, I am throwing error messages, and I know that for some reason under chrome, the following check doesn't pass:</p>
  
  <pre><code>string mimeType = picture.ContentType;
  
  // Check for the correct mimeType to define the extension
  switch (mimeType)
  {
      case "image/pjpeg":
          mimeType = ".jpeg";
          break;
      case "image/png":
          mimeType = ".png";
          break;
      case "image/x-png":
          mimeType = ".png";
          break;
      case "image/gif":
          mimeType = ".gif";
          // Conversion to image
          Image gifImage = Image.FromStream(picture.InputStream);
          FrameDimension dimension = new FrameDimension(gifImage.FrameDimensionsList[0]);
  
          int frameCount = gifImage.GetFrameCount(dimension);
          // Reject if its an animated gif
          if (frameCount &gt; 1)
          {
              return RedirectToAction("UploadPicture", new { error = 3 });
          }
          break;
      default:
          return RedirectToAction("UploadPicture", new { error = 1 });
  }
  </code></pre>
  
  <p>So apparently, under Chrome, the HttpPostedFileBase parameter picture isn't encoded right and loses its mime type, howwever, this might not be the only problem. What is excatly wrong with the HttpPostedFileBase parameter under Chrome, and how can I fix it?  </p>
  
  <p>Thank you for your attention, and thanks in advance for any help.</p>