title: Angular JS Image validation max size and valid format
body: <p>I want to show different validation message for maximum size and invalid format in image upload.
  Here is my code, but max size validation is not working,show only invalid file format validation.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>&lt;div class="group-row col-sm-10 col-sm-push-1"&gt;
      &lt;input class="control-set" type="file" ngf-select ng-model="image" name="image" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="5MB" ngf-multiple="false" ngf-min-size='1' ui-jq="filestyle"&gt;
      &lt;div ng-show="createUserForm.$submitted || createUserForm.image.$invalid" ng-model="image"&gt;
           &lt;span ng-show="createUserForm.image.maxSize" class="text-danger"&gt;File must be less than 5 MB.&lt;/span&gt;
           &lt;span ng-show="createUserForm.image.$invalid" class="text-danger"&gt;Only .jpg,jpeg and .png images are allowed.&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What i made mistake here???</p>