While trying to implement an MVC file upload example on Scott Hanselman\'s blog. I ran into trouble with this example code:
foreach (string file in Request.Files
The correct type to use is HttpPostedFileBase.
HttpPostedFileBase hpf = Request.Files[file];
Just work with it as an HttpPostedFileBase. The framework uses the HttpPostedFileWrapper to convert an HttpPostedFile to an object of HttpPostedFileBase. HttpPostedFile is one of those sealed classes that are hard to unit test with. I suspect that sometime after the example was written they applied the wrapper code to improve the ability to test (using HttpPostedFileBase) controllers in the MVC framework. Similar things have been done with the HttpContext, HttpRequest, and HttpReponse properties on the controller.