...

View Full Version : time ago... for uploaded file



pagedrop
11-12-2011, 07:21 PM
Hello,

looking for help on secs ago or mins ago or hrs ago for an uploaded file.

I have file upload script which uploads the files in a directory, so im looking for help, so the script reads the date and time, each file has been uploaded compares to now time or as of now time and gives out secs ago, mins ago etc...

thank you in advance for your help

Adee
11-12-2011, 11:27 PM
Hello,

looking for help on secs ago or mins ago or hrs ago for an uploaded file.

I have file upload script which uploads the files in a directory, so im looking for help, so the script reads the date and time, each file has been uploaded compares to now time or as of now time and gives out secs ago, mins ago etc...

thank you in advance for your help

use time()-filemtime(filename) to get the seconds since it was uploaded

pagedrop
11-13-2011, 12:17 AM
could you explain much more... in detail or with an example.
thank you

Adee
11-13-2011, 12:47 AM
if ur reading the files from a dir like..


<?php

$dir = "somedir";
$files = scandir($dir);
foreach($files as $img)
{
echo $img . "[ ".(time()-filemtime($img))." ]<br />";

}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum