Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 928
EdG Avatar asked Nov 19 '22 20:11

EdG


1 Answers

Try this

<input type="file" directory="" webkitdirectory="" multiple />
like image 153
First Arachne Avatar answered Jan 08 '23 12:01

First Arachne