科尔多瓦/电话间隙文件未创建为什么
cordova / phonegap file is not created why?
当我打开一个文件(cordova.plugins.fileOpener2.open.......)时,手机会通知您找不到该文件,但控制台中没有错误。 问题出在哪里?
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
//console.log(fileSystem.name);
//console.log(fileSystem.root.name);
//console.log(fileSystem.root.fullPath);
fileSystem.root.getFile("test.txt", {create: true}, function(entry) {
var fileEntry = entry;
// console.log(entry.fullPath);
entry.createWriter(function(writer) {
writer.onwrite = function(evt) {
console.log("some sample text");
};
writer.write("sample text");
writer.onwriteend = function(evt) {
$scope.pathFile = writer.localURL;
console.log($scope.pathFile);
cordova.plugins.fileOpener2.open(
$scope.pathFile,
'text',
{
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
}
}
);
};
}, function(error) {
console.log(error);
});
}, function(error){
console.log(error);
});
},
function(event){
console.log( event.target.error.code );
});
在之前测试以检查文件。
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
fileSystem.root.getFile("readme.txt", {create: true}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
console.log("gotFileEntry");
}
function fail(evt) {
console.log("Error : "+evt.code);
}
相关文章:
- 如何播放部分音频文件
- 从桌面读取python文件时高亮显示代码
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 如何使用WCF服务和javascript表单post上传.doc文件
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 如何在生成下载文件时显示加载动画
- 有没有任何方法可以将控制器从文件加载到ui路由器$stateProvider中
- Javascript-如何读取json文件中的列并将其保存在Javascript数组中
- 将jsp文件下拉列表中的选定项分配给一个java变量(比如String selection)
- 文件传输在电话间隙代码401
- 电话间隙 - 是否可以运行外部 *.jar 文件
- 如何在电话间隙中打开系统文件资源管理器
- 使用拼音间隙解压缩文件
- 电话间隙文件系统“未定义”
- 科尔多瓦/电话间隙文件未创建为什么
- 使用拼音间隙下载文件
- 电话间隙:操纵文件系统
- 科尔多瓦或电话间隙 :保存文件捕获器
- 电话间隙文件传输异步
- 是否可以在电话间隙中设置特定的文件路径