HTML5 drag and drop folder detection in firefox. Is it even possible?

后端 未结 3 1219
情书的邮戳
情书的邮戳 2020-11-30 09:21

I have a drop zone where I want to detect whether the dragged item is a folder or file. In chrome I achieved this by using

for (var i = 0; i < nrOfFiles;          


        
3条回答
  •  一整个雨季
    2020-11-30 09:59

    It IS possible in Firefox 42 and upwards (https://developer.mozilla.org/en-US/Firefox/Releases/42, https://nightly.mozilla.org/):

    https://jsfiddle.net/28g51fa8/3/

    e.g. by using Drang'n'Drop events: e.dataTransfer.getFilesAndDirectories();

    or by using a new input dialog, letting the user select between files or folder upload:

    
    
    

    Related Bugzillas:

    https://bugzilla.mozilla.org/show_bug.cgi?id=1164310 (Implement MS's proposal for a reduced subset of the new FileSystem API)

    https://bugzilla.mozilla.org/show_bug.cgi?id=1188880 (Ship directory picking and directory drag and drop)

    https://bugzilla.mozilla.org/show_bug.cgi?id=1209924 (Support filtering of Directory::GetFilesAndDirectories)

    https://bugzilla.mozilla.org/show_bug.cgi?id=876480#c21 (Released in Firefox 50, november 2016)

    Code partially from: https://jwatt.org/blog/2015/09/14/directory-picking-and-drag-and-drop (https://archive.is/ZBEdF)

    Unfortunatelly not in MS Edge so far: https://dev.modern.ie/platform/status/draganddropdirectories/

提交回复
热议问题