PHP Code21 Apr 2006 07:04 pm
Get file last modified timestamp
Retrieving last modified timestamp for a file
CODE:
-
<?php
-
//set path/filename or passed from form argument
-
$filename = '/path/filename.dat';
-
// checks that the file actually exists and queries the last modified timestamp
-
if (file_exists($filename)) {
-
echo "$filename exists";
-
echo " last timestamp: " . date("d-m-y", filemtime($filename));
-
} else {
-
echo "$filename does not exist";
-
}
-
?>
April 25th, 2006 at 8:34 am
Enjoyed your blog this morning. MonicaX