Testing for File Type

Newbie request: I’d like to modify a line of code that evaluates whether a file is of correct type or not:


onChange="TestFileType(this.form.Resume.value, ['doc', 'zip', 'pdf', 'txt'])"


function TestFileType( fileName, fileTypes ) {
    if (!fileName) {
        return;
    }
    fileName = fileName.toLowerCase(); // Convert extension to lowercase
    dots = fileName.split(".");
    //get the part AFTER the LAST period.
    fileType = "." + dots[dots.length-1];

    return fileTypes.join(".").indexOf(fileType) != -1?alert('That file type is acceptable'):alert("Please only upload files of these types: 

" + fileTypes.join(" .") + "

Replace spaces with undesrcores \"_\" or hyphens \"-\", and remove special characters from the file name.");
}

I only want the alert to show if the file type is incorrect, not if there are no problems with the file type. Thanks for your help.