Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting FileError when trying to use the HTML5 file api in google chrome

I was trying to create a file using the file system API in chrome. Initially I tried PERSISTENT storage as follows

window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
webkitStorageInfo.requestQuota(webkitStorageInfo.PERSISTENT, 1024*1024, 
    function(grantedBytes) {
        window.requestFileSystem(webkitStorageInfo.PERSISTENT, grantedBytes, onInitFs, 
        errorHandler);
    }, 
    errorHandler);

It was working fine initially. But now when I try the same code is giving me the following error

NOT_SUPPORTED_ERR: DOM Exception 9

Then I tried TEMPORARY file storage as follows

window.requestFileSystem(TEMPORARY, 1024*1024, onInitFs, errorHandler);

That is giving me some FileError with the code 2 which means Security Error. Can anyone please help me on these issues?

like image 690
Jophin Joseph Avatar asked Dec 05 '25 15:12

Jophin Joseph


1 Answers

Are you trying to place the code in a page that is stored on your local computer and run it with Chrome? Did you add the flag

--allow-file-access-from-files

in your Chrome shortcut? I happened to encounter the same error as yours and suddenly I realized that I forgot to add this flag to run my chrome.

like image 121
MK Yung Avatar answered Dec 08 '25 14:12

MK Yung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!