PHP - why is_dir returns TRUE when a dir doesn't exist?

eraljuan

New Member
My current directory structure is as follows:\[code\]C:\xampp\htdocs\PHP_Upload_Image_MKDIR\[/code\]In other words, the following directories do NOT exist at all.\[code\]C:\xampp\htdocs\PHP_Upload_Image_MKDIR\uploadedC:\xampp\htdocs\PHP_Upload_Image_MKDIR\uploaded\s002\[/code\]The problem is that when I run the following script, the function is_dir always return TRUE.Based on the manual, http://us2.php.net/manual/en/function.is-dir.phpis_dir: Returns TRUE if the filename exists and is a directory, FALSE otherwise. Do I miss something here?Thank you\[quote\]\[code\]$userID = 's002';$uploadFolder = '/PHP_Upload_Image_MKDIR/uploaded/';$userDir = $uploadFolder . $userID;echo '<br/>$userDir: ' . $userDir . '<br/>';if ( is_dir ($userDir)){ echo "dir exists"; // always hit here!!!}else { echo "dir doesn't exist";}mkdir($userDir, 0700);\[/code\]\[/quote\]\[code\]C:\xampp\htdocs\PHP_Upload_Image_MKDIR>dir /ah Volume in drive C is System Volume Serial Number is 30B8-2BB2 Directory of C:\xampp\htdocs\PHP_Upload_Image_MKDIRFile Not FoundC:\xampp\htdocs\PHP_Upload_Image_MKDIR>//////////////////////////////////////////////////////////\[/code\]Based on Artefacto's comments:\[code\]Here is the output of C:\PHP_Upload_Image_MKDIR\uploaded\s005 echo '<br/>' . realpath($userDir) . '<br/>';\[/code\]Thank you for the solutions.Best wishes
 
Back
Top