$filename = '/www/test1/*.pdf';
if (file_exists($filename))
{
echo "The file $filename exists";
}
else
{
echo "The file $filename does not exist";
}
I used above code but it checks for *.pdf file but not for all files belongs to .pdf extension
$filename = '/www/test1/*.pdf';
if (count(glob($filename)) > 0) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With