title: Upload a zip file via input type file angularjs
body: <p><a href="https://i.stack.imgur.com/9vatI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vatI.png" alt="enter image description here" /></a></p>
  <p>I don't do angularjs daily, and I've tried to add a upload file button. It should only take .zip and 20 MB max. I did</p>
  <p><em><strong>Try#1</strong></em></p>
  <pre><code>&lt;input class=&quot;pull-right&quot; type=&quot;file&quot; id=&quot;fileUpload&quot; name=&quot;fileUpload&quot; ngf-select=&quot;$ctrl.uploadFile()&quot; ngf-pattern=&quot;'application/zip'&quot; ngf-max-size=&quot;20MB&quot;&gt;
  </code></pre>
  <p><em><strong>Try#2</strong></em></p>
  <blockquote>
  <p>Add <code>onchange=&quot;angular.element(this).scope().setFiles(this)&quot;</code></p>
  </blockquote>
  <pre><code>&lt;input class=&quot;pull-right&quot; type=&quot;file&quot; id=&quot;fileUpload&quot; name=&quot;fileUpload&quot; ngf-select=&quot;$ctrl.uploadFile()&quot; ngf-pattern=&quot;'application/zip'&quot; onchange=&quot;angular.element(this).scope().setFiles(this)&quot; ngf-max-size=&quot;20MB&quot;&gt;
  </code></pre>
  <p>and my component file I have</p>
  <pre><code>this.uploadFile = {};
  this.uploadFile.Iserror=false;
  
  
  this.uploadFile = function(files) {    
      this.uploadFile.Iserror=false;
  
  
  
      console.log(files); //undefined
      
  
  
                     
      if(files[0].type!==&quot;zip&quot;){
          alert(&quot;Not a zip file.&quot;);
          this.uploadFile.Iserror=true;
          return false;
      }       
  };
  </code></pre>
  <p><a href="https://i.stack.imgur.com/dHzHt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dHzHt.png" alt="enter image description here" /></a></p>
  <p>What do I need to do to access the file I selected ?</p>