开发者

Secure and "squarified" photo uploading in ASP.NET MVC

开发者 https://www.devze.com 2023-04-06 02:12 出处:网络
I\'m building a website for a club, and I\'d like each member to be able to upload a profile photo. I\'ve seen a few questions and answers on SO about the basics of how to do this, but I\'m concerned

I'm building a website for a club, and I'd like each member to be able to upload a profile photo.

I've seen a few questions and answers on SO about the basics of how to do this, but I'm concerned about two things that are a little bit more challenging:

  1. Security - I want to prevent people from uploading files that are not valid images and/or c开发者_如何学Pythonontain malicious content.

  2. Uniformity - I want files to be of a reasonable size and images to be square. I would like to provide a UI to help the user crop the photo into a square once the photo has been uploaded and verified.

Ideally, I'd like to find a free/open-source utility that I can just plug in to my app and go. If there's nothing like that available, I'd appreciate advice and/or sample code.


I don't think there is any plug-in utility to help you. Best would be to just build something yourself. Here are two blog articles that could help you to easily create your own validator:

  • How to Securely Verify and Validate Image Uploads in ASP.NET and ASP.NET MVC
  • Image Upload & Validation with ASP.NET MVC 3
  • Image Upload, Crop and Resize with ASP.NET MVC jQuery Uploadify and jCrop
0

精彩评论

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

关注公众号