We will handle Image Validation using two ways, client side and server side. I have explained client side Image validation here. But you can also handle the server side Image Validation as you want.
Here is the Form <input> field to upload an Image file. I added "accept" attribute in the Input tag which indicates the types of file the server accepts. (read more: https://developer.mozilla.org/en/docs/Web/HTML/Element/input)
Here is the Reusable Image validation Script. In this Script it allows only JPEG, JPG and PNG files but you can add more file extensions as you want.
Note: Do not put this Script within (document).ready(function(){}) otherwise may be it will not work.
Requirements:
jQuery
Bootstrap
Client Side Image Validation Using jQuery and Bootstrap
Here is the Reusable Image validation Script. In this Script it allows only JPEG, JPG and PNG files but you can add more file extensions as you want.
Note: Do not put this Script within (document).ready(function(){}) otherwise may be it will not work.
Requirements:
jQuery
Bootstrap
Comments
Post a Comment