
Uploading multiple files in one go has always been possible in PHP through the multiple
attribute on <input type="file">
. But what if you want users to upload an entire directory structure (folders with nested files)?
Modern browsers like Chrome and Edge support the webkitdirectory
attribute, which allows users to select a folder and upload all its contents—including subfolders—in one request.
In this post, I’ll walk you through how to use webkitdirectory
on the frontend and handle uploaded directories in PHP 8.1 using $_FILES
.
Â
The webkitdirectory
attribute can be combined with multiple
to allow folder uploads:
What's your reaction?
Excited
0
Happy
0
Not Sure
0
Confused
0