For folder input Reactjs is not accepting "webkitdirectory directory" as atttributes to input

Viewed 2658

I am trying to have a folder input instead of file input. I want to select a folder and not just a single file. I tried available solutions from already asked question, but non of them worked. This is what I tried

Tried

 <input id="myInput" type="file" webkitdirectory directory multiple/>

Faced Problems

1). I am working on react and react highlights "webkitdirectory directory" and says "attribute directory no allowed here". Seems like react is rejecting these attributes. How to solve this?

https://bugs.chromium.org/p/chromium/issues/detail?id=59818

2). I have read that Linux doesn't support folder selection. I am working on linux and I cannot select a folder. Is the problem because of this? How can I solve it?

I think if 1st one gets solved then things will be fine. Please suggest a solution or work around for this.

1 Answers

Try this

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