Showing posts with label Validate Upload file type using Javascript. Show all posts
Showing posts with label Validate Upload file type using Javascript. Show all posts

Wednesday, February 1, 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();
}