I was looking for a way to enable users to upload folders to a webpage. While I have already found out that this can be achieved with the webkitdirectory attribute of the input tag, I stumbled across something I don’t understand. Many answers (like this one), also include a directory attribute in the input tag. Like so:
<input type="file" webkitdirectory directory multiple/>
I was not able to find documentation on the directory attribute, and playing around with it myself, it didn’t seem to do anything. What is its function, and do I need to include it?
>Solution :
The directory attribute in the HTML input tag is an old way to allow users to select folders, but it’s not necessary anymore. The newer webkitdirectory attribute does the job, so you can just use that one.