File Search - Php

How to search a file using php code?

Snippet Code

Rate this page :
  [ 0 votes]

This php code is used to search a file. Here, function search_file_name($file) is used to search file. An alert is displayed if file exists ads "File exists", else "File does not exists".

<?php function search_file_name($file) { if (file_exists($file)) { return true; } else { return false; } } $filename = './Mycall1.php'; if(search_file_name($filename)) { echo "$filename exists"; } else { echo "$filename does not exist"; } ?>


Ask Questions

Ask Question