VapoRizer Posted November 19, 2013 Share Posted November 19, 2013 I need to save some files to a persistent local file system. A week ago I started a thread on stackexchange on this topic. Hopefully I can find some experts here: I have following code in my app.js:function onInitFs(fs) { aGlobalFsRoot = fs.root; console.log('04Position'); alert("Welcome to Filesystem! It's showtime :)"+fs); // Just to check if everything is OK }function openFS() {navigator.webkitPersistentStorage.requestQuota (1*1024*1024, function(grantedBytes) { console.log ('test1'); reqFS(grantedBytes);}, errorHandler);}function reqFS(grantedBytes) { window.webkitRequestFileSystem(window.PERSISTENT, grantedBytes, function(fs) { console.log ('test2'); alert("Welcome to Filesystem! It's showtime :)"+fs); // Just to check if everything is OK }, errorHandler);}function errorHandler(e) { var msg = ''; switch (e.code) { case FileError.QUOTA_EXCEEDED_ERR: msg = 'QUOTA_EXCEEDED_ERR'+e; break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'+e; break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR z.B. Speicherplatz wurde abgelehnt.'+e; break; case FileError.INVALID_MODIFICATION_ERR: msg = 'INVALID_MODIFICATION_ERR'+e; break; case FileError.INVALID_STATE_ERR: msg = 'INVALID_STATE_ERR'+e; break; default: msg = 'Unknown Error'+e; break; }; console.log('Error: ' + msg);}openFS is called on pageload. The code is based on this topic (where it also doesn't seem to work for newer versions of chrome). I can't get it to work. All the time, the errorHandler is called. It makes no difference if the filesystem already exists or not. The quota seems to work.I get two different console logs: When accsess is granted by user: Error: Unknown Error[object DOMError] app.js:81 When access is denied by user: test1 app.js:45 Error: SECURITY_ERR z.B. Speicherplatz wurde abgelehnt.[object FileError] app.js:81 Anyone got this working? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.