luc154 Posted May 1, 2015 Share Posted May 1, 2015 Im running a site and have a problem. Visitors can download sermons and can see when the sermon was preached. The problem is that everytime I upload a sermon I have to mannually insert the date of the file into the code. Even if I manually edit the date of the file (last modification date) on my pc. When I upload the file to the server it automatically takes on the current date. I tried the touch function and filemtime function but to no avail. The time keeps ticking and is not static. The whole idea is that I change the modification time on my pc and just upload the sermon and then on the server through code get the time the file was last modified. And that would be the date the sermon was preached. Quote Link to comment https://forums.phpfreaks.com/topic/296004-modification-time-does-not-change/ Share on other sites More sharing options...
CroNiX Posted May 1, 2015 Share Posted May 1, 2015 Yes, the OS has control of lastmtime. Whenever something is changed on a filesystem, THAT filesystems OS sets the lastmodtime. So if you upload a file to a server, that servers OS is updating the file on the filesystem so it automatically changes the lastmtime. Perhaps a better way would be to name your files to contain the date of the sermon, and use that as that won't change when uploading. 2015-04-25-sermon-name.mp4 2014-08-25-sermon-name.mp4 Quote Link to comment https://forums.phpfreaks.com/topic/296004-modification-time-does-not-change/#findComment-1510518 Share on other sites More sharing options...
luc154 Posted May 1, 2015 Author Share Posted May 1, 2015 Thank you. If there is no other way then that would be the last resort. Quote Link to comment https://forums.phpfreaks.com/topic/296004-modification-time-does-not-change/#findComment-1510523 Share on other sites More sharing options...
gizmola Posted May 1, 2015 Share Posted May 1, 2015 There is software called rsync that is very good for synchronizing data between 2 servers. I'd recommend looking at that, and using rsync to move files from your workstation up to the server. Quote Link to comment https://forums.phpfreaks.com/topic/296004-modification-time-does-not-change/#findComment-1510524 Share on other sites More sharing options...
sKunKbad Posted May 14, 2015 Share Posted May 14, 2015 I nice way to do this might be to create a sermon management console with uploader where you can specify the date and time you want. As the upload is being saved, you would save the path to the file, and any other details (like the date and time, name of pastor, topic, etc) in a database table (sermons_data). Later, if you decide to change anything about the sermon, you would just go back to your console and make the edit. Although wretched as an application, WordPress as a CMS using custom post types would handle this well for you. Even if nobody ever sees the WordPress app, you could just use it to populate a database, and then pull in the content through custom queries. I do this a lot because WordPress is a bloated hog. Quote Link to comment https://forums.phpfreaks.com/topic/296004-modification-time-does-not-change/#findComment-1511943 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.