call FileSystemAPI to create a file in local sandboxie. The code is as follows:
readerFile:function(file,callBack){
fileSystemObj.fs.root.getFile(file, {create: true}, function(fileEntry) {
console.log(3);
fileEntry.file(function(file) {
console.log(4);
var reader = new FileReader();
reader.onloadend = function() {
typeof callBack == "function" && callBack.call(fileEntry,this.result);
};
reader.readAsText(file);
}, fileSystemObj.errorHandler);
}, fileSystemObj.errorHandler);
},
initialize : function(filename) {
window.requestFileSystem(TEMPORARY, this.size, function (fs) {
fileSystemObj.fs = fs;
fileSystemObj.readerFile(filename,function(text){
console.log(text);
});
})
}
};
if(window.requestFileSystem) {
navigator.webkitTemporaryStorage.queryUsageAndQuota(function (usage, quota) {
if (!quota) {
console.log(1);
navigator.webkitTemporaryStorage.requestQuota(fileSystemObj.size, function () {
fileSystemObj.initialize();
}, fileSystemObj.errorHandler);
}else{
console.log(2)
fileSystemObj.initialize();
}
});
}else{
alert("chrome!");
}
}
error report under the console:
2
sandbox_fileSystem.js:23 SecurityError
DOMException: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.
how do you solve this problem?