I have a question regarding to JavaScript validation. I am validaing the whenever my scripts runs, it validates but also the action
You can use the File Api to test for magic number. Maybe take a look at this answer for other ideas about the validation. More reliable than the file extension check.