Gen. partnerAlgotech

PHP function file_exists()

Checks whether a file or directory exists

|
September 11, 2019

Availability in PHP 4.0

Checks whether a file or directory exists

Parameters

Parameter Data type Default value Note
$filename string not Path to the file or directory.

Return values

bool

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

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

This function returns false for files inaccessible due to safe mode restrictions. However these files still can be included if they are located in safe_mode_include_dir.

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

Other resources

Official file-exists documentation

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.