Chrome Extension

Check if file exist in PHP

    $filePath = "/path/to/file";
    if (file_exists($filePath)) {
        echo "file exists at the location";
    } else {
        echo "file does not exist";
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
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?
Join Devsheet Ask a Question