I have 4 file input tags to upload files as follows,
Left File : <input type="file" name="dataFile1" id="fileChooser1" />
Right File : <input type="file" name="dataFile2" id="fileChooser2" />
Config File : <input type="file" name="dataFile3" id="fileChooser3" />
<button type="button" id="execute" onclick="ValidateFile()">Click to Upload files</button>
Now, I want to make sure that only distinct files are are being uploaded.
How do I do this is JS/JQ without using third party plugins?
I've used,
var FileName1 = document.getElementById('fileChooser1').value;
var FileName2 = document.getElementById('fileChooser2').value;
if(FileName1 == FileName2)
{
alert("Same files cannot be uploaded");
}
But this checks only for the names of the files that are being uploaded, if two files with different names but same content are uploaded then they are being identified as different files.