title: How to check file type before uploading with AngularJS?
body: <p>I want to upload a zip file to server. Before uploading, I have to check if it's a zip file.</p>
  
  <p>If it's a zip file, then submit. <br>
  If it's not a zip file, it comes up "Not a zip file." and the file can't be uploaded.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="{{restUrl}}" method="post" enctype="multipart/form-data" name="myForm" novalidate&gt;
    &lt;input type="file" id="fileUpload" name="fileUpload"&gt;
    &lt;p ng-show=""&gt;Not a zip file.&lt;/p&gt;
    &lt;input type="submit" value="Upload"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I wish it could be a directive or a controller in AngularJS. </p>