Requirement specfication:
- Upload a picture from a webform 开发者_如何学编程(ASP.NET MVC application) to my database.
- validation of the picture's width and height should be performed before applying into "app data" category.
- Validate the picture's format. The following format should be gif, jpeg,jpg and png
Problem:
Have tried googling 'round in the Internet but can't find a solution to my requirement specification.Phil Haack's blog post should solve your problem: http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
The HttpPostedFileBase type allows you to check for the picture's mimetype or you can find the extension. To find the width and height of the picture you can use System.Drawing.Image.
精彩评论