To determine if a file has been selected, you can find out the length of the input file
$("#bCheck").click(function() { // bCheck is a input type button var fileName = $("#file1").val(); if(fileName) { // returns true if the string is not empty alert(fileName + " was selected"); } else { // no file was selected alert("no file selected"); } });
user474407
source share