Creating a Directory
| From: | PartyPosters | Date: | Tue, 12 Apr 2005 18:01:57 +0000 |
| Subject: | Creating a Directory | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212946@lists.php.net to get a copy of this message | ||
Hello, I am using the following script to upload files to my server. Is there anyway I can create a
directory (on the fly) for the new image to go, as I want people to be able to upload files with the
same name.
Thanks
$uploadDir = 'uploads/';
$uploadFile = $uploadDir . $_FILES['form_data']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['form_data']['tmp_name'], $uploadFile))
{
print "File is valid, and was successfully uploaded. ";
# print "Here's some more debugging info:\n";
#print_r($_FILES);
}
else
{
print "File is invalid. ";
# print "Possible file upload attack! Here's some debugging info:\n";
# print_r($_FILES);
}
print "</pre>";