How to check if a file exists in Laravel

public function fileexists($filename)
{
    if (file_exists($filename)) 
    {
        return $filename;
    } 
    else 
    {
        return 'img/defaultimg.png';
    }     
}
🔥31 Views

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.