Home  »  CodeLibrariesProgrammingSnippetsTechnology   »   Check if File Exists Using PHP

Check if File Exists Using PHP

Posted: May 11, 2022 | by Site Host

Use this code snippet to check if file exists using PHP.

$filename = '/path/to/file.txt';

if ( file_exists( $filename ) ) {

   // do something with the file

} else {

   // file does not exist


Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Share it!

See also  How to Search Whole MySQL Database for a Particular String