Vytvoření adresaře a ověřená zda už neexistuje

Poradí někdo jak ověřit zda už adresař neexistuje před jeho vytvořením ? adresař tvořim takto :

mkdir("foto/".$_SESSION['userid']."", 0777);
echo "Váš adresár byl vytvoren<br>";

a po té hned upload fotek

díky za případné rady
http://us3.php.net/manual/en/function.file-exists.php
Česky: http://us3.php.net/manual/cs/function.file-exists.php
Zajímavý je rozdíl v jazykových mutacích manuálu:

file_exists -- Checks whether a file or directory exists
file_exists -- Zjistí, zda soubor existuje
ale ja nechci zjistit zda existuje soubor ale adresař :-(
file_exists -- Checks whether a file or directory exists
Checks whether a file or directory exists = Zjisti, zda soubor nebo adresar existuje
is_dir();