title: How to check if file type is a specified file type(Image) in vue.js?
body: <p>Helo. i want to check my input file type if it's jpg or not. i worked with 'vee-validate', which it was fine, but what i like to do is like what I've did with file size base on a tutorial.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;input type="file" @change="updateMelliCodeFrontScan" name="mellicode_front_url" class="form-input" &gt;
  </code></pre>
  
  <p>Here's the Vue method:</p>
  
  <pre><code>updateMelliCodeFrontScan(e){
              // console.log('uploading');
              let file = e.target.files[0];
              let reader = new FileReader();
              // let vm = this;
              if (file['size'] &lt; 200000){
  
                      reader.onloadend = (file) =&gt; {
                          // console.log('RESULT', reader.result)
                          this.form.mellicode_front_url = reader.result;
                      }
                      reader.readAsDataURL(file);
              }else
              {
                  swal({
                      type: 'error',
                      title: 'Size limited.',
                      text: 'size limit',
                  })
              }
  },
  </code></pre>
  
  <p>so i want to do it like this:</p>
  
  <pre><code>=&gt; i want to make another if for file type base on extension/type like file['type']. 
  
  i used file['type'] === jpg and didn't worked.
  if (file['size'] &lt; 200000){
  
                      reader.onloadend = (file) =&gt; {
                          // console.log('RESULT', reader.result)
                          this.form.mellicode_front_url = reader.result;
                      }
                      reader.readAsDataURL(file);
              }else
              {
                  swal({
                      type: 'error',
                      title: 'Size limited.',
                      text: 'size limit',
                  })
  }
  </code></pre>