【发布时间】:2014-02-17 02:16:11
【问题描述】:
我有以下代码将图像存储在 S4 上的目录“myApp”中
function gotFileEntry(fileEntry){
var gotFileSystem = function(fileSystem) {
alert("got file Sys: " + fileSystem.name);
fileSystem.root.getDirectory("myApp", {
create : true
}, function(dataDir) {
alert("got dir :" + dataDir.fullPath);
alert("got image file entry: " + fileEntry.fullPath);
// move the file
fileEntry.moveTo(dataDir, "1.jpg", null, failFS);
}, failFS);
};
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFileSystem,failFS);
}
function SaveImage(){
// curImageURI has value of imageURI from onPhotoURISuccess()
window.resolveLocalFileSystemURI(curImageURI, gotFileEntry, failFS);
}
“myApp”目录在 S4 上的路径:/storage/emulated/0/myApp
curImageURI 中的值:/storage/emulated/0/Android/data/com.apps.myApp/cache/1392602140698.jpg
以下是我收到的警报:
得到文件 Sys: 持久
得到目录://myApp
得到图片文件入口:/1392602140698.jpg
在 fileEntry.moveTo(...) 时出现以下错误。
System.err java.io.FileNotFoundException: 源不存在
我不明白我哪里出错了。如果有人可以帮助我,我将不胜感激。 提前谢谢你。
【问题讨论】:
-
您认为我的答案正确吗,请检查为正确答案。
标签: android image cordova fileapi