Search code examples
htmlreactjsfolderbrowserdialog

How to make Select Directory using React?


I need to upload all files from a folder to server. I'm trying to implement Select Directory window, and not Select file.

The normal way like:

<input type="file" webkitdirectory directory/>

Did not work for me, and showed Select File window.

But when I created empty regular html file with this input tag, it was working fine. Does anybody know how to implement the solution using React?

Thank you!


Solution

  • try bheptinh.

    <input directory="" webkitdirectory="" type="file" />