更新时间:2022-05-03 01:38:22
您可以使用 phonegap 中的 FileReader 对象检查文件是否存在.您可以检查以下内容:
You could check if the file exists using the FileReader object from phonegap. You could check the following:
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);