我对iOS的Cordova文件传输方法有点困惑。(我有一个使用Android的版本)
显然,我没有正确地设置目标文件夹。target:null Could not create target file注意到,我假设该目录是在脚本前面成功创建的情况下存在的。
根据Cordova文档,我应该使用entry.toURL来获得正确的路径。
function download(filename){
var localPath = rootFS.toURL+'contentImages/'+filename;
var fileTransfer = new FileTransfer();
fileTransfer.download(encodeURI('http://myValidatedSource.com/'+filename),
localpath,
function(entry){
console.log('download completed for '+entry.fullPath);
},
function(error){
console.log(error);
}
);
}我也试过这个:
alert(rootFS.fullPath); ==> "/"和
alert(rootFS.toURL); ==> "function(){
if (this.nativeURL){
return this.nativeURL;
}
return this.toInternalURL()|| "file://localhost"+this.fullPath";
}"发布于 2014-05-14 17:29:13
我还没走远..。
var localPath = rootFS().toURL+'contentImages/'+filename;而不是
var localPath = rootFS.toURL+'contentImages/'+filename;https://stackoverflow.com/questions/23648941
复制相似问题