I want to upload whole folder to server. I have found after extensive research to use webkitdirectory directory in input tag. its workinf fine and now it is also selecting folder from the dialog. but it is only showing list of all files in the folder it is not uploading full folder to the server.
My html code is as follows:
<div class="upload" style="width: 30px; height: 30px; margin-top: -29px; margin-left: 90%; background: url(http://192.168.1.30/sannan/upload.png);">
<input type="file" name="myfile" id="myfile" onchange="submitForm()" webkitdirectory directory/>
</div>
My upload script is as follows:
<?php
$output_dir = "upload/";
if(isset($_FILES["myfile"]))
{
//Filter the file types , if you want.
if ($_FILES["myfile"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br>";
}
else
{
foreach($_FILES["myfile"] as $file)
{
move_uploaded_file($file["tmp_name"],$output_dir. $_FILES["myfile"]["name"]);
}
echo "Uploaded File :".$_FILES["myfile"]["name"];
}
}
?>
its only uploading first file in the folder to the server. I want to upload full folder including all files and subfolder to the server.