Link to home
Start Free TrialLog in
Avatar of travisjbennett
travisjbennettFlag for United States of America

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\uploader.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/uploads/';
$nominee = $nominee_first_name . " " . $nominee_last_name;
mkdir($uploaddir . $nominee);
$uploadfile = $uploaddir . $nominee . "/" . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $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>";
?>
ASKER CERTIFIED SOLUTION
Avatar of Tomeeboy
Tomeeboy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial