Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    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

  • #3
    New Coder
    Join Date
    Oct 2005
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts
    could you explain much more... in detail or with an example.
    thank you

  • #4
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    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 />";

    }
    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •