CoderZone.org

Category: >> PHP Code >> Check if a file exists Bookmark and Share

<< lastnext >>

Snippet Name: Check if a file exists

Description: Use PHP to check if a file exists or not.

Also see:
» Simple directory viewer / browser
» Read a web page directly in to a s...
» Recursive Directory Browser
» Saving Remote Images With PHP
» Include All Files In A Directory
» More File Type Detection in PHP
» Get Current Page URL
» Get Current Directory Name
» Measure script run time
» Write to File example
» Export table to Excel or MS Word f...
» Count lines in file
» Copy File From Server
» Remove All Files An A Given Direct...
» Calculate File/Folder Size In A Di...

Comment: (none)

Author: CoderZone
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009

<?php
 
$filename = 'test.csv'; 
 
if (file_exists($filename)){
 
print "The file $filename exists";
 
}else{
 
print "The file $filename does not exist";
 
}
 
?>
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 31