Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-12-2011, 07:21 PM   PM User | #1
pagedrop
New Coder

 
Join Date: Oct 2005
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
pagedrop is an unknown quantity at this point
Question time ago... for uploaded file

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
pagedrop is offline   Reply With Quote
Old 11-12-2011, 11:27 PM   PM User | #2
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
Quote:
Originally Posted by pagedrop View Post
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
Adee is offline   Reply With Quote
Old 11-13-2011, 12:17 AM   PM User | #3
pagedrop
New Coder

 
Join Date: Oct 2005
Posts: 61
Thanks: 12
Thanked 0 Times in 0 Posts
pagedrop is an unknown quantity at this point
could you explain much more... in detail or with an example.
thank you
pagedrop is offline   Reply With Quote
Old 11-13-2011, 12:47 AM   PM User | #4
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
if ur reading the files from a dir like..
PHP Code:
<?php

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

}
?>
Adee is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:17 PM.


Advertisement
Log in to turn off these ads.