Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, October 1, 2013

Using java script to check Signature and Photo

Check for Photo

function ValidatePhoto() {
        var msg = "";
        var bIsValid = true;        
        var uploadedFile = document.getElementById('MainContent_FileUploadPhoto');
        if (uploadedFile.files[0].size > 51200 || uploadedFile.files[0].size < 20480) // greater than 512KB
        {
            uploadedFile.outerHTML = uploadedFile.outerHTML;
            alert('File size is not as the prescribe size.');
            bIsValid = false;
        }
        //On Success
        return true;

    }



check for Signature
function ValidateSignature() {
        var msg = "";
        var bIsValid = true;
        var uploadedFile = document.getElementById('MainContent_FileUploadSignature');
     if (uploadedFile.files[0].size > 20480 || uploadedFile.files[0].size < 10240) // greater than 512KB
        {
            uploadedFile.outerHTML = uploadedFile.outerHTML;
            alert('File size is not as the prescribe size.');
            bIsValid = false;
        }
        //On Success
        return true;
    }