How can I filter out directories from upload handler in Firefox?

后端 未结 3 918
慢半拍i
慢半拍i 2021-01-18 22:37

Problem

I have following code snippet that is used to get file information during file drag and drop upload:

var files = event.dataT         


        
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-18 23:29

    Solution

    I came up with following dirty workaround that works on Firefox version - 46.0.1

    It uses FileReader API to check if uploaded file is directory or not.

    Code

    Drop your files here!

    Related Links

    • FileReader API
    • JavaScript Promise

提交回复
热议问题