title: Is it possible to validate the size and type of input=file in html5
body: <p>I was reading this <a href="http://dev.w3.org/html5/markup/input.file.html" rel="noreferrer">http://dev.w3.org/html5/markup/input.file.html</a>, but I only found the "accept" attribute.</p>
  
  <p>I tried this </p>
  
  <pre><code>&lt;input type="file" name="imagefilename" accept="image/x-png, image/gif, image/jpeg" /&gt;
  </code></pre>
  
  <p>Is it possible client-side validation of file size?</p>
  
  <p>I found this technique for IE</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  function getSize()
  {
      var myFSO = new ActiveXObject("Scripting.FileSystemObject");
      var filepath = document.upload.file.value;
      var thefile = myFSO.getFile(filepath);
      var size = thefile.size;
      alert(size + " bytes");
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="upload"&gt;
  &lt;input type="file" name="file"&gt;
  &lt;input type="button" value="Size?" onClick="getSize();"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Is it possible to do the same using <a href="http://www.html5rocks.com/en/tutorials/file/filesystem/" rel="noreferrer">html5 filesystem api</a> ? </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I could do this (<a href="http://jsfiddle.net/9bhcB/" rel="noreferrer">demo</a>):</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form &gt;
          &lt;input type=file id=f max-size=32154 &gt;
          &lt;input type=submit&gt;
      &lt;/form&gt;
  &lt;script&gt;
  $(function(){
      $('form').submit(function(){
          var isOk = true;
          $('input[type=file][max-size]').each(function(){
              if(typeof this.files[0] !== 'undefined'){
                  var maxSize = parseInt($(this).attr('max-size'),10),
                  size = this.files[0].fileSize;
                  isOk = maxSize &gt; size;
                  return isOk;
              }
          });
          return isOk;
      });
  });
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>It is working fine, but I think It will be better to a native html5 attr to validate</p>