Hello ben,
You can try this out in twoi ways. First you can make use of function is_dir() to check. If this function returns false then that file or whaterver is not a directry otherwise it is.
Seacondly you can try file_exists() function. It looks awkward but that works.
Hope this helps
Cheers
Vinay