views:

278

answers:

1

FTP/PHP question here. On one of my pages I load .txt files from a directory. Pretty simple. I also display the modified date of the text file using this:

date('m/d/Y', filemtime($file));

This works fine on my WAMP server but when I upload the files via FTP, the modified date is changed to when they were uploaded. I'm currently hosting on a free hosting provider (freehostia to be exact). Is there any way to keep the modified date/time from changing when it's uploaded? Or is there perhaps an alternative way to go about this? Any ideas are appreciated.

A: 

There's an option in most FTP clients to preserve modification times of files when uploaded -- hunt around your options for it. I know FileZilla and WinSCP at least support this. Only some FTP servers will acknowledge this, though.

If your server doesn't support it, you'll have to come up with some other method to do what you're doing. In the long run I'd recommend finding some other way anyway, because typically the last modified time isn't a "critical" piece of data that is always kept in sync across backups, file transfers, etc. If the date is stored (for example) in the file, you'll never have to worry about losing it.

zildjohn01
I assumed FileZilla (which is what I use) would have a feature like this, yet I can't seem to find it. :(
Nate Shoffner
Ok....I feel so dumb right now. It was right under my nose, well, under the Transfer menu. "Preserve timestamps of transferred files". I was looking under settings and everything. Thanks lol.
Nate Shoffner
No problem, glad you figured it out
zildjohn01
Well I found out my server doesn't support it I guess. Tried 2 other FTP clients. No luck. :(
Nate Shoffner