Hi all
I have a form where a user can upload a file. I do a check to see if it's a zip file. If it isn't then its supposed to stop the file from being uploaded. Only thing is, the file still uploads regardless of getting the error or not.
How can I prevent the form from submitting the file if the error pops up?
function checkForm() {
var filename = document.getElementById('file').value;
var fileext = filename.substring(filename.lastIndexOf('.')+1);
if (fileext != 'zip')
{
alert('File must be in zip format (*.zip)');
return false;
}
}