PHP.nl

file_exists

file_exists

Checks whether a file or directory exists

bool **file_exists** string $filename

Checks whether a file or directory exists.

filenamePath to the file or directory.

On windows, use or to check files on network shares.

Returns true if the file or directory specified by exists; false otherwise. filename

Opmerking: > This function will return false for symlinks pointing to non-existing files.

Opmerking: > The check is done using the real UID/GID instead of the effective one.

Voorbeeld: Testing whether a file exists

<?php
$filename = '/path/to/foo.txt';

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}
?>

is_readable``is_writable``is_file``file``SplFileInfo