title: Upload file to server using ionic
body: <p>I am building a mobile app using ionic. One of the usecase is to let the user browse a file and upload it to the backend server (which exposes a rest service).</p>
  
  <p>On the UI, I am using the html file tag</p>
  
  <pre><code>&lt;input type="file" ng-select="uploadFile($files)" multiple&gt;
  </code></pre>
  
  <p>This opens a file browser to select a file. Then in the controller, I am doing the following</p>
  
  <pre><code>.controller('UploadDocCtrl', function ($scope, $cordovaFileTransfer) {
  
  $scope.uploadFile = function(files) {
    console.log("selected file "+files);
   // hard coded file path "/android_asset/www/img/ionic.pdf" to be replaced with the user selected file
    $cordovaFileTransfer.upload(restServiceEndpoint, "/android_asset/www/img/ionic.pdf", properties).then(function(result) {
      console.log("SUCCESS: " + JSON.stringify(result.response));
    }, function(err) {
      console.log("ERROR: " + JSON.stringify(err));
    }, function (progress) {
      // constant progress updates
    });
  });
  </code></pre>
  
  <p>The problem is that I am not able to get a reference to the selected file. Can someone please help with the steps to achieve this. Thanks!</p>