After 1 long month, i found the solution. There was a min file with the template and inside that there was a code as follows specially for mozilla :
if (b.browser.mozilla) {
n.on("click", function () {
if (!k.disabled && !m.attr("readonly")) {
m.click()
}
})
}
When i removed this, it no longer triggers the file upload twice. I guess this was used for older versions of mozilla. There was lots of styles related to a single file button and the original file type was hidden from view.