How to check if a file or directory exists using php
Posted: Sun Feb 21, 2010 4:05 pm
Code: Select all
<?php
$filename = '/path/file.txt';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>