Cordova 3.4.0 Filetransfer download Error Code 1

4,489 views
Skip to first unread message

Torsten Rosenberger

unread,
Feb 21, 2014, 5:54:45 AM2/21/14
to phon...@googlegroups.com
Hello 

I update my phonegap 3.0.1 to cordova 3.4.0.
in hope that the CLI ist faster with build and installing.
This was success.

But the same code which worked on 3.0.1 throw now a error 
during downloading a file.

I have read that there where some changes in the fullPath for the root
Filesystem.


First i request a filesystem
window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem) 

all ok, then create a directory also ok.


remoteFile = 'http://www.example.com/myfile.png'
localPath  = '/mydir/myfile.png'

var ft = new FileTransfer();

ft.download(remoteFile,localPath, function(entry) {

  },
  function(error) {
    console.log(error);
    console.log("download error source " + error.source);
    console.log("download error target " + error.target);
    console.log("download error code" + error.code);
  }
);

in mydir Directory the File myfile.png ist created with a size of 0
Bytes.
and i got the error Code 1 (FILE_NOT_FOUND_ERR) 

witch file is not Found ?
when the remote is not Found why a local is created ?
in the server logs there is no access to the remoteFile so it must be a
problem with the local ?

BR/Torsten

mbelluco

unread,
Feb 25, 2014, 8:36:12 AM2/25/14
to phon...@googlegroups.com
I have the same problem, any ideas?

Anthony Rumsey

unread,
Feb 25, 2014, 10:47:41 AM2/25/14
to phon...@googlegroups.com
I have updated my FileTransfer downloads to use filesystem URLs instead of paths which fixed the issue for me.

eg.

localPath = fileSystem.root.toURL() + 'mydir/myfile.png';

redeemy

unread,
Mar 7, 2014, 8:43:05 PM3/7/14
to phon...@googlegroups.com
Thanks for that! Also found this works:
 
localPath = "cdvfile://localhost/persistent/mydir/myfile.txt"
 
as written (though unfortunately not clearly or fully) at the end of the notes for the file-transfer plugin.
 
In the filesystem URL above, the "persistent" directory seems to be special and required; initial attempts at using "cdvfile://localhost/myfile.txt" failed. Couldn't find documentation on this...
Reply all
Reply to author
Forward
0 new messages