Is it possible to upload a folder with a file input in the browser?
I searched and found out that this might be a browser limitation and that I might need to use a J
Please Try This for upload the folder :
<form method="post" enctype="multipart/form-data">
<input type="file" name="files[]" id="files" multiple="" directory="" webkitdirectory="" mozdirectory="">
<input class="button" type="submit" value="Upload" />
</form>
$count = 0;
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
foreach ($_FILES['files']['name'] as $i => $name) {
if (strlen($_FILES['files']['name'][$i]) > 1) {
if (move_uploaded_file($_FILES['files']['tmp_name'][$i], 'folder/'.$name)) {
$count++;
}
}
}
}
`
It's becoming possible with use of webkitdirectory.
<input type="file" webkitdirectory directory multiple />
Supported since Firefox 50, Chrome 30, Safari 11.1, Edge 14, but not on most mobile browsers as of 2019: https://caniuse.com/#feat=input-file-directory