OM The Eternity
OM The Eternity

Reputation: 16194

How to get modified time and size of any file using PHP?

How to get modified time and size of any file using PHP?

Upvotes: 6

Views: 4850

Answers (4)

Praveen kalal
Praveen kalal

Reputation: 2129

you can use this

echo date("m/d/Y",filemtime("latestime.php")); 

Upvotes: 4

Sarfraz
Sarfraz

Reputation: 382616

You can use filemtime and filesize functions for that.

More info here

Upvotes: 2

Gordon
Gordon

Reputation: 316939

SplFileInfo provides a high level API to the file system:

$file = new SplFileInfo('path/to/file');
echo $file->getMTime();
echo $file->getSize();

Upvotes: 9

Thomas Dignan
Thomas Dignan

Reputation: 7102

From php.net http://us.php.net/manual/en/function.stat.php

stat

(PHP 4, PHP 5)

stat — Gives information about a file

Upvotes: 7

Related Questions