The file_exists() function will work for both questions. It will simply tell you if there is something in the filesystem with that name. If you need to know what kind of thing it is, you can use the filetype() function. You can also use is_dir() and is_file(). See the online manual, Part IV "Function Reference", Chapter XX "Filesystem functions".