如何检查Phonegap框架中是否存在目录和文件?

时间:2013-01-18 04:14:34

标签: android ios cordova blackberry

如何检查Phonegap框架中是否存在目录和文件?
这是如何在Phonegap中完成的 请帮帮我

1 个答案:

答案 0 :(得分:1)

您可以使用文件阅读器对象。

var reader = new FileReader();
var fileSource = <here is your file path>

reader.onloadend = function(evt) {

if(evt.target.result == null) {
   // If you receive a null value the file doesn't exists
} else {
    // Otherwise the file exists
}         
};

// We are going to check if the file exists
reader.readAsDataURL(fileSource);  
相关问题