title: AngularJS: Is there any way to get size of file?
body: <p>I'm implementing a check in which I dont want to upload the image which has size greater than <code>4MB</code>. I'm using <code>file reader</code> and <code>new image()</code>. I've the image size and width. But how can I get the filesize.</p>
  
  <pre><code>function previewImage(element) {
    var reader = new FileReader();
  
    reader.onload = function (event) {
      seAddArtist.imageSource = event.target.result;
      $scope.$apply();
    };
    // when the file is read it triggers the onload event above.
    reader.readAsDataURL(element.files[0]);
  }
  
  
  var img = new Image();
  img.onload = function () {
    alert(this.width + 'x' + this.height);
  }
  </code></pre>
  
  <p>I am implementing these two combine but how can i check the size of image?</p>