JSFiddle - React, Tailwind, and code Playground

by hiteshbhilai2010

HTML

<input type="file" placeholder="Video file" class="dupFile" id="gl_video_file">

JavaScript

$('body').on('change', '#gl_video_file', function(e) {
                var glVideoFiles = event.target.files;
                glVideoFileSplit = glVideoFiles[0].name.split(".");
                glVideoFileFormat = glVideoFileSplit[1];
                glVideoFileName = glVideoFileSplit[0].split(' ').join('_')
                //alert ("File name : "+glVideoFileName)
                
                if (!glVideoFileName.match(/^[a-z0-9_-]+(\.mp4)$/i)) {
                  alert('First check : Bad file name format.');
                }
                if (!($('#gl_video_file').val()).match(/^[a-z0-9_-]+(\.mp4)$/i)) {
                  alert('Second check : Bad file name format.');
                }
  
  
            });