Jump to content

Displaying the date/time a file is uploaded


whatap

Recommended Posts

Hello, I've been trying to get my upload script to display the time and date files are uploaded through my upload script. I just can't get it working. I've tried to make the script touch the file right after it's uploaded and display the date the file was modified as a workaround, but everything I do displays the date as 1969-12-31 18:00.

 

Can anyone give me some insight as to how I can correctly show the time files are uploaded?

Link to comment
Share on other sites

PHP does that when it cannot find the file.

 

This code will display the last modified, the file needs to exist on the server, or you will get: Page Last Edited 12/31/69 04:00

 

So either it doesn't exist, or your path is incorrect.

 

<?php
$last_modified = filemtime("index.php");
print("Page Last Edited");
print(date("m/j/y h:i", $last_modified));
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.