Uploading an image from device

I am trying to use cordova file transfer to upload an image to amazon s3 through a rest api.

as it stands the code creates the file at the location but it is always empty. What am i doing wrong?

this is what i use in my controller:

`
$scope.getPhoto = function(source) {

    var options = {
                quality: 75,
                destinationType: Camera.DestinationType.FILE_URI,
                sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
                allowEdit: true,
                encodingType: Camera.EncodingType.JPEG,
                targetWidth: 300,
                targetHeight: 300,
                popoverOptions: CameraPopoverOptions,
                saveToPhotoAlbum: false
            };
    
    $cordovaCamera.getPicture(options).then(function (imageURI, imageData) {
                    path = imageURI;
                    console.log(path14);
                    $scope.imgURI = "data:image/jpeg;base64," + imageData;
                }, function (err) {
                    // An error occured. Show a message to the user
                });
}

ionic.Platform.ready(function(){
$scope.uploadFile = function() {
 var url = "https://df-local.enterprise.dreamfactory.com/api/v2/S3/images/SOMEFILENAME.jpg?api_key=dAPIKEY";
 //target path may be local or url
 var targetPath = path;
   //console.log($scope.path);
  var filename = targetPath.split("/").pop();
    var options = {
        fileKey: "file",
        fileName: filename,
        chunkedMode: false,
        mimeType: "image/jpg"
    };
    $cordovaFileTransfer.upload(encodeURI(url), encodeURI(targetPath), options).then(function(result) {
        
        console.log("SUCCESS: " + JSON.stringify(result.response));
        alert("success");
        alert(JSON.stringify(result.response));
    }, function(err) {
        console.log("ERROR: " + JSON.stringify(err));
        alert(JSON.stringify(err));
    }, function (progress) {
        // constant progress updates
        $timeout(function () {
        $scope.downloadProgress = (progress.loaded / progress.total) * 100;
      })
    });
}
});`

can anybody spot whats wrong?