Is there ever a way possible to get the actual creation / modification time of the file being uploaded, using JavaScript / PHP?
As for JavaScript, I have researched a lot, tried quite a few codes, but to no luck (perhaps trying to do possible out of impossible).
As for PHP, using filectime() and filemtime(), it only shows the date / time the file is uploaded, and not the time the file is actually created / modified on the source.
In short, what I want is to check the m-time of a file before/during/after upload (where-ever possible) and decide whether or not to store the file on the server, and report the same back to the client.
Perhaps you could use javascript to get the last modified time, then use that in some other javacript to sort on that. This time will be in GMT.
If you're talking about the file date/time on the user's machine (e.g., client-side), your only option other than going down a proprietary path (ActiveX — which would be a very unpleasant user experience with warnings making many users run for the hills — Flash, etc.) is the relatively-new, not-widely-supported File API, which provides the
lastModifiedDate
. But again, you'd have to detect whether the browser supported it, and then include that information in a separate (for instance, hidden) field.When I say the file API isn't widely supported yet, actually that depends on your point of view: Firefox, Chrome, and Opera do support it in recent versions (Firefox for a long time, it was their idea). Apparently IE doesn't support it yet, not even in IE9 (I haven't personally verified that).
Here's a rough-but-complete example of reading the last modified date (live copy):
JavaScript does not have access to the local filesystem, so you can't get to this information without using Flash, Java or Active-x.