title: how to convert html file to byte array using angularjs
body: <p>I need to convert a photo into an array of bytes. I'm loading this photo with html like this:</p>
  
  <pre><code>&lt;input class="form-control"
             type="file"
             name="filename"
             tooltip="Buscar foto"
             ng-file-select="onFileSelect($files)"&gt;
  </code></pre>
  
  <p><code>onFileSelect</code> function saves the file in a variable of my scope. This is the code.</p>
  
  <pre><code>$scope.onFileSelect = function ($files) {
          $scope.selectedFile = $files;
      };
  </code></pre>
  
  <p>Now, I need to convert this file into an array of bytes, to display it as a picture later using <code>data-ng-src =" data: image / png; base64, {{selectedFile}} "</code> but i don't know how to do this. Any idea? Thanks</p>
  
  <p><strong>EDIT</strong>
  This is a picture of $files log.</p>
  
  <p><a href="https://i.stack.imgur.com/CwUZE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CwUZE.png" alt="enter image description here"></a></p>