title: how to accept only apk file in react js?
body: <pre><code>import React from &quot;react&quot;;
  export default function DropDown() {
    const changeHandler=()=&gt;{
      let value=document.getElementById('someId');
      let ext = value.match(/\.([^\.]+)$/)[1];
      switch (ext) {
        case 'apk':
          alert('Allowed');
          break;
        default:
          alert('Not allowed');
          value = '';
      }
    };
  return (
      &lt;&gt;
       &lt;input type=&quot;file&quot; id=&quot;someId&quot; accept=&quot;.apk&quot; onChange={changeHandler} /&gt;
      &lt;/&gt;
    );
  }
  </code></pre>
  <p>after selecting file it throws error value.match is not a function. how to resolve that if we click upload button if we upload apk file popup throws allow or else popup is not allowed</p>