Skip to main content
3 of 4
added 4 characters in body
Cerbrus
  • 72.7k
  • 65
  • 370
  • 513

stacksnippets error when reading uploaded directories

What causes

"DOMException: A URI supplied to the API was malformed, or the resulting Data URL has exceeded the URL length limitations for Data URLs."

at snippet-javascript-console.min.js?

Minimal, verifiable, complete example to demonstrate the issue

var dropzone = document.querySelector("input[type=file]");

dropzone.ondrop = function(e) {

  e.preventDefault();

  var item = e.dataTransfer.items[0].webkitGetAsEntry();

  var directoryReader = item.createReader();
    
  directoryReader.readEntries(
    function(entries) {}
  , function(err) {
      console.error(err);
    }
  );

}
<input type="file" webkitdirectory>

To reproduce use Chrome or Chromium browsers and run stacksnippets and drop a directory at <input type="file"> element. The code does not throw an error at either jsfiddle or plnkr.

guest271314
  • 1
  • 1
  • 12
  • 13