travisjbennett
asked on
PHP mkdir: Warning: mkdir() [function.mkdir]: File exists in (PathToScript.php) on line #
I have a PHP form handler that uploads files. It is below. It is on PHP server version 5.1.1 with Windows 2003. It gives the following error. All the permission seem to be right to write to the directories. Where did I go wrong?
ERROR RESULTS:
Warning: mkdir() [function.mkdir]: File exists in c:\Inetpub\wwwroot\mae-oaa \trav\uplo ader.php on line 7
File is valid, and was successfully uploaded.
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => Todo.txt
[type] => text/plain
[tmp_name] => C:\PHP\uploadtemp\php1476. tmp
[error] => 0
[size] => 288
)
)
UPLOADER.PHP
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/inetpub/wwwroot/trav/upl oads/';
$nominee = $nominee_first_name . " " . $nominee_last_name;
mkdir($uploaddir . $nominee);
$uploadfile = $uploaddir . $nominee . "/" . basename($_FILES['userfile ']['name'] );
echo '<pre>';
if (move_uploaded_file($_FILE S['userfil e']['tmp_n ame'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Error!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
ERROR RESULTS:
Warning: mkdir() [function.mkdir]: File exists in c:\Inetpub\wwwroot\mae-oaa
File is valid, and was successfully uploaded.
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => Todo.txt
[type] => text/plain
[tmp_name] => C:\PHP\uploadtemp\php1476.
[error] => 0
[size] => 288
)
)
UPLOADER.PHP
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/inetpub/wwwroot/trav/upl
$nominee = $nominee_first_name . " " . $nominee_last_name;
mkdir($uploaddir . $nominee);
$uploadfile = $uploaddir . $nominee . "/" . basename($_FILES['userfile
echo '<pre>';
if (move_uploaded_file($_FILE
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Error!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.