Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the function of the directory attribute in the html input tag?

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading