title: ngcordova android file select and upload to server
body: <p>I want to upload file from my ionic application to server. I am using cordovafiletransfer plugin. Using that I am able to upload file by providing static path in controller code. My question is how to get selected file path by user? I only get filename from input tag on the relative path of selected file. How to get that?</p>
  
  <p>View Page Code:</p>
  
  <pre><code>&lt;label class="item item-input"&gt;
      &lt;div class="input-label"&gt;Upload Photo&lt;/div&gt;
      &lt;input type="file" onchange="angular.element(this).scope().setFile(this)" accept="image/*"/&gt;
  &lt;/label&gt;
  &lt;div class="padding"&gt;
      &lt;button ng-click="upload()" class="button button-block button-assertive"&gt;Upload&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Controller Code:</p>
  
  <pre><code>$scope.upload = function() {
      var filename, options, targetPath;
      console.log($scope.theFile);
      targetPath = cordova.file.externalRootDirectory + '/Download/androidify.png';
      filename = targetPath.split('/').pop();
      options = {};
      options.fileKey = 'image_file';
      options.fileName = $scope.theFile.name;
      options.chunkedMode = false;
      options.mimeType = $scope.theFile.type;
      options.headers = {
          'Authorization': getDeviceToken()
      };
      console.log(options);
      return $cordovaFileTransfer.upload(domain.uploadphoto(), targetPath, options).then(
              (function(result) {
                  console.log('SUCCESS: ' + JSON.stringify(result.response));
              }), 
              (function(err) {
                  console.log('ERROR: ' + JSON.stringify(err));
              }), 
              function(progress) {}
      );
  };
  
  $scope.setFile = function(element) {
      return $scope.$apply(function($scope) {
          console.log(element);
          return $scope.theFile = element.files[0];
      });
  };
  </code></pre>
  
  <p>How to get proper target path of selected file?</p>