Chrome Extension

Check if file exist in PHP

<?php
    $filePath = "/path/to/file";
    if (file_exists($filePath)) {
        echo "file exists at the location";
    } else {
        echo "file does not exist";
    }
?>
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now
Output
return true if exists and false if not exists

To check whether a file exists on a location or not you can use the file_exists function in PHP can be used. It will return true if it found the file on the given location and return false if it does not find the file on the location.

file_exists takes a file path as a parameter and check for the file if it exists on the given parameter location or not.

Was this helpful?
0 Comments
Open Code Manager We are hiring