/frontend-tips GitHub 486★

Select a folder to upload

We often use the file input to give users a way to choose and upload one or multiple files:

<!-- Upload a single file -->
<input type="file" />

<!-- Upload many files -->
<input type="file" multiple />

The input also has a special attribute named webkitdirectory which allows users to choose and upload an entire folder including all of its sub directories recursively.

<input type="file" webkitdirectory multiple />

It's supported in all modern browsers.

See also

Follow me on and to get more useful contents.