Question: I've ran into some problems while using cordova plugin File Transfer. Thats my code:

```
window.requestFileSystem(
    LocalFileSystem.PERSISTENT,
    0,
    function onFileSystemSuccess(fileSystem) {
        fileSystem.root.getFile(
            "dummy.html", {create: true, exclusive: false},
            function gotFileEntry(fileEntry) {
                var sPath = fileEntry.fullPath.replace("dummy.html", "");
                var fileTransfer = new FileTransfer();
                fileEntry.remove();

                fileTransfer.download( 'http://cordova.apache.org/images/cordova_bot.png', sPath + photo.original_name,
                    function (theFile) {
                        alert('success: ' + JSON.stringify(theFile));
                        console.log("download complete: " + theFile.toURI());
                        // showLink(theFile.toURI());
                    },
                    function (error) {
                        alert('error: ' + JSON.stringify(error));
                        console.log("download error source " + error.source);
                        console.log("download error target " + error.target);
                        console.log("upload error code: " + error.code);
                    },
                    true
                );
            })
    },
    function (error) {
        alert('error request: ' + JSON.stringify(error));
    }
);

```

The fileTransfer.download's error callback is being returned with error code 3, http 401.
I already updated the File and FileTransfer plugins, my cordova version is 4.3.0.
Also checked my config.xml for 

```
<access origin="*" />

```

but it's there. 
I tried adding the header Connection: close, but no result.
Tried setting the download's 4th param to its default (false) too - no luck.

Testing on Android tablet.

Anyone anything? Thanks!

Answer: 
I personally wouldn't create a file then remove it just to get a directory URL. You should be able to obtain just that by doing `fileSystem.root.toURL()` - fileSystem.root is a DirectoryEntry and so contains methods you'd expect to see on a DirectoryEntry.

Just a bit quicker.

**Update**

If you feel inclined to use the file delete method, you should be using toURL() on the FileEntry, not fullPath. I think toURL() returns a URL that can be used throughout HTML app.

But as I say, fileSystem.root.toURL() is preferable. Example code as follows:

Thus, your code becomes:

```
window.requestFileSystem(
    LocalFileSystem.PERSISTENT,
    0,
    function (fileSystem) {
        var url = 'http://cordova.apache.org/images/cordova_bot.png',
            dir = fileSystem.root.toURL() + photo.original_name,
            ft = new FileTransfer();

        ft.download(url, dir,
            function (fileEntry) {
                alert('Downloaded!');
            },
            function (error) {
                alert('Download error');
                console.log(dir);
            }
        );
    },
    function (error) {
        alert('Error getting file system');
    }
);

```

Try that and see what happens. Might sound stupid, but I presume `photo.original_name` is defined? And there's a '/' between the directory and the filename?
This worked for me

```
let pathToDownload = `${cordova.file.externalDataDirectory}`;
let fileTransfer   = new FileTransfer();    
let url            = encodeURI(`https://cordova.apache.org/images/cordova_bot.png`);

fileTransfer.download(url, pathToDownload + "image.png",
    (fileEntry) => {
        console.log('Downloaded!');
    },
    (error) => {
        console.log('Download error');           
    },                      
);

```