I'm aware of the typical tutorials that you can find via google that will allow you to upload one file at a time.
And then retrieving it with an upload.php file that has:
SOURCE: http://www.netspade.com/articles/php/uploading.xml
But how would I go about uploading a whole directory? I want to be able to select a directory and then PHP will chug away at adding all the files in that directory to a directory on the server. I have been unable to find any documentation on the web to help with this.
Thanks in advance!
HTML:
<form enctype="multipart/form-data" action="upload.php" method="post">
Upload: <input name="userfile" type="file" />
<input type="submit" value="Upload File" />
</form>
And then retrieving it with an upload.php file that has:
PHP:
<?php
$uploadDir = '/var/www/uploads/';
$uploadFile = $uploadDir . $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
{
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
}
else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";
?>
But how would I go about uploading a whole directory? I want to be able to select a directory and then PHP will chug away at adding all the files in that directory to a directory on the server. I have been unable to find any documentation on the web to help with this.
Thanks in advance!