title: Javascript Regular expression for image file to FileUpload control in asp.net
body: <p>I am trying to verify image file which is choose by user in FileUpload control in web page at client side by using javascript.
  Can anybody tell me how can i make it.
  I am trying this code for that which is not working :</p>
  
  <pre><code>function validateFileExtension() 
  {
      var re =/\.(gif|jpg|JPEG|tiff|png)$/i;
      var temp = document.getElementById('&lt;%=FileUpload1.ClientID %&gt;').value;
  
      if (re.test(temp)) 
      {
          return ("Invalid image file type.");
  
          return false;
      }
  
      return "";
  }
  </code></pre>