title: Angular 2 - Validate if a file is really an image
body: <p>In Angular 2 how to validate if a file is really an image?</p>
  
  <pre><code>isImage(file: File): boolean {
      return /^image\//.test(file.type);
  }
  </code></pre>
  
  <p>In the above function after an upload, simply change the <code>.txt</code> to <code>.png</code> file extension it returns <code>true</code> eg: <code>text.txt</code> to <code>text.png</code> </p>