我正在尝试从服务器下载图像并将其存储在SD卡上,然后将其显示在黑莓10上。
但我无法下载该文件。
这是我的代码:
fileTransfer.download(
"http://smartphone.thnt.vn/VietGames/GhepTranhTu/IOS/update/" + anhup[i],
"file:///SDCard/downloads/" + anhup[i],
function (entry) {
sa = entry.fullPath;
alert("download complete: " + entry.fullPath);
if(i < anhup.length - 1) {
doDownload(i + 1);
} else {
alert("download done");
}
}, function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code" + error.code);
}
);
答案 0 :(得分:0)
从此获取SD卡目录路径: -
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFSData, fail);
function gotFSData(fileSystem) {
console.log(fileSystem.root);
fileSystem.root.getDirectory("download",
{create: true, exclusive: false},
gotFileEntrywriter,
fail);
}