Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 contain 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.

like image 456
devuxer Avatar asked Sep 21 '11 00:09

devuxer


1 Answers

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
like image 115
Laurent Avatar answered Oct 17 '22 14:10

Laurent