I need to check if any of the 4 uploaded files are same, this check might be on the JSP or Java-Servlet side.
I've been using
var FileName1 = document.getElementById('fileChooser1').value;
var FileName2 = document.getElementById('fileChooser2').value;
if(FileName1 == FileName2)
{
alert("same files cannot be uploaded");
}
But, the problem is that this only deals with the name of the file and this fails if files with same content but different names are uploaded.
So, on apache commons search I found that there is a Default Comparator but I have no idea of how I can use this or is there any other better/simpler way to check for same files.
- How can I use the Default Comparator and on what basis does it compare?
- Is there any better/simpler solution to this problem in java or javascript?