5

i want to use the synchroneous JS FileSystem API, therefore, this code has to be put to a webworker. the incoming data for the webworker are taken from a dragndrop event (dataTransfer.items) in order to be able to use chromes newest capabilitiy to upload folders. sadly, every try is canceled by chrome with a "Uncaught Error: DATA_CLONE_ERR: DOM Exception 25".

basically, its like this:

  var files=e.dataTransfer.items; [copying the DataTransferItemList]
  var worker=new Worker(...)
  worker.postMessage(files);

this does not work. any idea, why? a similar (but not 100% identical) example can be found here: http://www.html5rocks.com/en/tutorials/file/filesystem-sync/ - this seems to work. its not a DataTransferItemList, its a FileList there - cant this type of List be serialized?

Thanks, Christoph

4

1 回答 1

0

您应该使用event.dataTransfer.files来获取FileList. 然后您可以将其直接发布给工作人员:

var files=e.dataTransfer.files || e.target.files; // Cross browser FileList
var worker=new Worker(...);
worker.postMessage({files: files});
于 2015-11-10T04:37:29.407 回答