Problems with cordova-plugin-file-transfer


I want to upload a file from the mobile app to my server. The file browsing with cordova camera works perfect, but the I have problems in the upload part. If I use it like this I can’t even open the page with this method in it. If I delete $cordovaFileTransfer on the first line in my function, I can open the page with this function but of course there is $cordovaFileTransfer missing and it doesn’t work. My code does look like this:

function ($scope, $stateParams, $http, $cordovaCamera, $cordovaFileTransfer) {

$scope.uploadPhoto = function(){
    var options = {
        quality: 50,
        destinationType: Camera.DestinationType.FILE_URI,
        sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
        allowEdit: true,
        encodingType: Camera.EncodingType.JPEG,
        popoverOptions: CameraPopoverOptions,
        saveToPhotoAlbum: false

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

        var image = document.getElementById('tempImage');
        image.src = imageData;  

        var server = "",
            filePath = imageData;

        var date = new Date();

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

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

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

    }, function(err) {


Thanks in advance.