sg72 Posted March 6, 2013 Share Posted March 6, 2013 What i am trying to do is create a page where i can enter a filename in a form and get the creation date of that file. This is the html page <html><body><form action="c.php" method="post">Name: <input type="text" name="fname"><input type="submit"></form></body></html> This is the php page <?php$last_mod = filectime("fname");print("file creation date is ");print(date("m/j/y h:i", $last_mod));?> Link to comment https://forums.phpfreaks.com/topic/275326-need-help-with-filectime/ Share on other sites More sharing options...
requinix Posted March 6, 2013 Share Posted March 6, 2013 [edit] filectime() is not the creation time of the file. The "c" stands for "change", specifically the change time of the file's inode. Which is not the same as the "m"odification time. It's filesystem stuff. Linux filesystems don't really keep track of the creation time so there's no way to get that there. On Windows filectime() might return a value that's the same as the creation time. Link to comment https://forums.phpfreaks.com/topic/275326-need-help-with-filectime/#findComment-1416963 Share on other sites More sharing options...
sg72 Posted March 6, 2013 Author Share Posted March 6, 2013 I am using it on a windows webserver and it does show the creation time. Link to comment https://forums.phpfreaks.com/topic/275326-need-help-with-filectime/#findComment-1416964 Share on other sites More sharing options...
requinix Posted March 6, 2013 Share Posted March 6, 2013 Alright, so long as you know that this only works on Windows. $last_mod = filectime("fname");You're telling it to look for a file named "fname". The $_POST array contains the value you need. Link to comment https://forums.phpfreaks.com/topic/275326-need-help-with-filectime/#findComment-1416970 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.