Click here to Skip to main content
15,888,155 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to set regular expression or validation for a passport size photo(uploads)
Posted
Comments
Suvendu Shekhar Giri 29-Oct-15 1:25am    
Anything you have tried so far?
Sergey Alexandrovich Kryukov 29-Oct-15 1:38am    
What makes you thinking that regex would be helpful here? :-)
—SA

You can do that by getting the demension values of the uploaded image.
Here is a very good example of how you can do that.
Validate (Check) dimensions (Height and Width) of Image before Upload using HTML5, JavaScript and jQuery[^]

Hope, it helps :)
 
Share this answer
 
Refer this article,
http://www.aspdotnet-suresh.com/2014/01/jquery-check-file-image-size-before-upload.html[^]

Or do something like,
JavaScript
$("#passPortPhotoUpload").change(function () 
{ 
    var size = ($("#passPortPhotoUpload")[0].files[0].size / 1024); 
    size = (Math.round(size * 100) / 100)
    alert( size  + "kb"); 
}); 


-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900