Image Upload From Cordova Camera

     quality: 100,
     destinationType: Camera.DestinationType.FILE_URI,
     sourceType: Camera.PictureSourceType.CAMERA,
     encodingType: Camera.EncodingType.JPEG,
     allowEdit: true,
     popoverOptions: CameraPopoverOptions,

   };

   $scope.takePicture = function(data){

     $cordovaCamera.getPicture(options).then(function(imageData) {
        $scope.lastPhoto = imageData.substr(imageData.lastIndexOf('/') + 1)
        $scope.lastPhoto = file

        $scope.upload(imageData,data)

     }, function(err) {
       console.err(err)

     });


   }
   $scope.upload = function(file,value){
     $scope.aboveDreams = file
     Upload.upload({
       url: ApiEndpoint.url + '/documents',
       data:{file: file, documentType: value}

     }).then(function(resp){

       console.log('Success ' + resp.config.data.file.name + 'uploaded. Response: ' + resp.data);
     },function (resp){
       console.log('Error status: ' + resp.status)
     },function(evt){
       var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
       console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
     })
   }

I am using ng-file-upload which every times when sending to server throws MultiPart Param file is not present

What am i missing here !

I think i solved it using the cordovaFileTransfer.upload()

Now it is working here is the code

` var options = {
quality: 100,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.JPEG,
allowEdit: true,
popoverOptions: CameraPopoverOptions,

};

$scope.takePicture = function(data){

 $cordovaCamera.getPicture(options).then(function(imageData) {

         //console.log(imageData);
         //console.log(options);

         $scope.image = imageData;

         var server = ApiEndpoint.url + "/documents",
             filePath = imageData;

         var date = new Date();

         token = window.localStorage.getItem('authtoken')

         var options = {
             fileKey: "file",
             fileName: imageData.substr(imageData.lastIndexOf('/') + 1),
             chunkedMode: false,
             mimeType: "image/jpg",
             headers: {'Authorization': 'bearer ' + token}
         };




         $cordovaFileTransfer.upload(server, filePath, options).then(function(result) {
             console.log("SUCCESS: " + JSON.stringify(result.response));
             console.log('Result_' + result.response[0] + '_ending');
             alert("success");
             alert(JSON.stringify(result.response));

         }, function(err) {
             console.log("ERROR: " + JSON.stringify(err));
             //alert(JSON.stringify(err));
         }, function (progress) {
             // constant progress updates
         });


     }, function(err) {
         // error
         console.log(err);
     });
 }

`