如何使用PhoneGap检查Android上的SD卡上是否存在Excel文件(.xlsx)?如果文件退出,我如何通过javascript导入和导出文件内容?
答案 0 :(得分:0)
首先将cordova File插件添加到您的项目中。然后使用以下代码:
var reader = new FileReader();
var fileSource = <file path>;
reader.onloadend = function(evt) {
if(evt.target.result != null) {
// If you receive not null value the file exists
} else {
// Otherwise the file doesn't exists
}
};
// We are going to check if the file exists
reader.readAsDataURL(fileSource);