Currently, I'm developing an application for uploading folders and files. I have two problems: I can't upload files by keeping the tree (subfolders and their files).Here is the code:
<form method="post" action='post_upload.php' enctype="multipart/form-data">
<input type="file" name="files[]" id="files" webkitdirectory directory multiple>
<input class="button" type="submit" value="Upload" />
post_upload.php:
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], 'upload/'.$name)) {
echo $name."<br>";
}
}
}
If this problem is resolved, then it is possible to select more than one folder?
Thanks.