RESOURCE ADDED ON SUNDAY 28 MAY 2006, 17:56:11
Category: PHP Code
Language(s): PHP
Description: Getting information about a given file
The code is listed below; click on it to download the code as a text file.
<?php
$file = "yourfilegoeshere.php";
$fileinfo = stat( $file );
echo "File name: " . $file . "<br />\t";
echo "File type: ." . substr( strrchr( $file, "." ), 1 ) . "<br />\n";
echo "Filesize: " . round( ( $fileinfo[ "size" ] / 1024 ), 1 ) . "k<br />\n"; // size in bytes
echo "Last accessed: " . date( "H:i:s, d/m/y", $fileinfo[ "atime" ] ) . "<br />\n"; // time of last access (Unix timestamp)
echo "Last Modified: " . date( "H:i:s, d/m/y", $fileinfo[ "mtime" ] ) . "<br />\n"; // time of last modification (Unix timestamp)
?>
This code has been downloaded 439 time(s) and viewed 12396 time(s).
Back to Resources
Back to Code
Back to PHP Code
Credits
This resource was written by Tim Bennett Bsc (Hons). Tim Bennett has a First Class Degree in
Multimedia Systems Computing
from Leeds Metropolitan University. He works as a freelance multimedia developer under the company name
Texelate creating free and
commissioned
high-quality multimedia solutions. Find out more by visiting the portfolio section and viewing his blog. If
you'd like to request a resource get in touch!
Rate this Resource
Click on the appropriate star below to rate this resource:
Num votes: 7912
Average: 8 / 10
Comments
Post a Comment
See all comments