title: Check for Invalid characters(Special Characters & International character) in file name without validating file path
body: <p>I am trying to validate a file name with invalid characters in the file name without validating file path. I have tried various combinations but none of my javascript functions seem to do the trick. </p>
  
  <pre><code> @Html.TextBoxFor(model =&gt; model.Attachment, new { type = "file" , onchange = "ValidateFileName(this)" })
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>function ValidateFileName(name) {
          if (name.value.match(/\.\.[a-z][a-z][a-z]$/) || name.value.match(/\.\.[a-z][a-z][a-z][a-z]$/) || name.value.match(/^(?!\.)(?!com[0-9]$)(?!con$)(?!lpt[0-9]$)(?!nul$)(?!prn$)[^\|\*\?\\:%&lt;&gt;/$"]*[^\.\|\*\?\\:%&lt;&gt;/$"]+$/)) {
  
              alert('Invalid file extension.');
              name.form.reset();
              name.focus();
              return false;
          }
      }
  </code></pre>