Every time user upload an image or a file, we have to validate it and display preview to user before actually it on server. Now it is possible to read file and its properties on client side (before uploading on server) using HTML5 and JavaScript. Let’s assume we have an uploader control on page having id=imguploader . <input type="file" id="imguploader" name="image" accept="image/*"> Here’s a function I‘ve created that validate the image uploded by user & display the image preview. $('#imguploader').bind('change', function() { var file = this.files[0]; //we can retrive the file array. // alert(file.type); if you want to check image type, uncomment this line. // alert(file.size); if you want to check the image size, uncomment this line. var reader = new FileReader(); // file.target.result holds the DataURL which // can be used as a source of the image: //imgpreview is the id of...