FileSystem API - error writing blob from dropped file

65 views
Skip to first unread message

jaybuffet

unread,
Aug 2, 2012, 2:24:44 AM8/2/12
to chromium...@chromium.org
so I am trying to write a file to the filesystem.  The console shows "error" then "write end".  it seems to be an INVALID_STATE_ERR (code 7).  the "data" is a file that has been dropped on a hotspot.  if I change it to var bb = new Blob(["boo"], {type: "text/plain"}); it works fine.  Any help is appreciated.  Thanks you
 
  this.fileSystem.root.getFile(name, { create: true },
   function (fileEntry) {
    fileEntry.createWriter(function (fileWriter) {
     fileWriter.onwriteend = function (e) {
      console.log('write end');
      successCallback(fileEntry.name);
     };
     fileWriter.onprogress = function (e) {
      console.log('progress');
     };

     fileWriter.onwrite = function (e) {
      console.log('writing');
     }
     fileWriter.onerror = function (e) {
      console.log('error');
      //debugger;
     };
     var bb = new Blob([data], { type: datatype } );
     fileWriter.write(bb);
    }.bind(this));
   }.bind(this), function (e) {
   });

jaybuffet

unread,
Aug 2, 2012, 9:45:43 AM8/2/12
to chromium...@chromium.org
I figured out my issue.  I was dropping a file which I didn't have write permissions.  I did this same test storing the same file in indexeddb (using firefox and ie10) and I didn't get an error.  How is interactions with the filesystem api different?
Reply all
Reply to author
Forward
0 new messages