I'm developing an app that should upload with a for a directory to the server, I've alredy change the configuration for the max upload size in the php.ini
indeed the upload is done correctly.
I know the function move_uploaded_file to "store" a single file uploaded but my question is there is a way to use it for a directory uploaded?
This is my code:
HTML:
<form action="upload.php" 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>
PHP:
if (isset($_POST["submit"])) {
if ($_FILES["file"]["error"] > 0) {
} else {
$storagename = $_FILES["file"]["name"];
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $storagename);
}
}
$a= scandir("upload");
print_r($a);
With this code the result of the print is this:
Array ( [0] => . [1] => .. )
How can solve it?
Thank's