Wednesday, 1 February 2017

Validate Upload file type using Javascript

Validate Upload file type using Javascript

function()
{  
           var fup = document.getElementById('FileName');
            var fileName = fup.value;
            var ext = fileName.substring(fileName.lastIndexOf('.') + 1);
            if (ext == "pdf" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG") {
                return true;
            }
            else {
                alert("Upload pdf or images only");
                fup.focus();
                return false;
            }
}


Function for close Popup Window using Javascript

function()
{
window.close();
}

No comments:

Post a Comment