开发者

Picture's validation in height, width and format

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜