How to handle this case in javascript?

I am trying to validate that only mp4 file is input by user other than mp4 no file input is allowed to user

So this is working fine according to my logic I am spilting value in input file field

after that I am comparing its last string with mp4 if it is fine go for it otherwise block

this work fine if I have name of file like this


but this doesnot work in thse case when there is more than one dot in input file type like this

So How can I handle these seneraio?

use the last element of the array.

that was I am thinking but how?

Ok I will follow this link

I have tried this but not working

you have to fix several typos, then it works.

what types of typo?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.