Detect folders in Safari with HTML5


You can try to run the following code to detect folders in Safari −

Array.prototype.forEach.call(e.dataTransfer.files, function (file) {
   var r = new FileReader();
   r.onload = function (event) {
      addFile(file);
   };
   r.onerror = function (event) {
      alert("Uploading folders isn't supported in Safari browser!");
   }
   r.readAsDataURL(file);
});

Updated on: 25-Jun-2020

77 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements