Computer >> Computer tutorials >  >> Programming >> Javascript

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);
});