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));?> Quote 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 (edited) [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. Edited March 6, 2013 by requinix Quote 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 (edited) I am using it on a windows webserver and it does show the creation time. Edited March 6, 2013 by sg72 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/275326-need-help-with-filectime/#findComment-1416970 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.