How to check if a file exists in PHP

1 Answer

0 votes
/*
bool file_exists ( string $filename )
*/  

$filename = 'e:/test.txt';

if (file_exists($filename)) 
    echo "File exists";
else 
    echo "File does not exist";


/*
run:
  
File exists

*/

 



answered Dec 16, 2015 by avibootz
...