How to Check If a File Exists in PHP

PHOTO EMBED

Sun Jan 30 2022 16:32:10 GMT+0000 (Coordinated Universal Time)

Saved by @uncogeek #php

<?php

$filename = 'readme.txt';

if (file_exists($filename)) {
    $message = "The file $filename exists";
} else {
    $message = "The file $filename does not exist";
}
echo $message;
Code language: HTML, XML (xml)
content_copyCOPY

https://www.phptutorial.net/php-tutorial/php-file-exists/