Jump to content

[SOLVED] Get last modified time of remote file during upload


koramado

Recommended Posts

Hello,

 

I'm creating a script which allows users to upload data contained in a text file, which is then parsed for inclusion in a database. I am trying to find a way to read the last modified value of the file being uploaded so that I can include a timestamp of when the data was created. I have been trying to use the various functions to read the last modified time, but can only get the time after the file is uploaded to the server.

 

I am wondering if it is at all possible to check the last modified time of a remote file being uploaded, so I can use the time the file was originally created and not the uploaded time for timestamping the data.

 

Any insight is appreciated.

 

Joel

Your server, and consequentially PHP, doesn't have access to the remote file until it's uploaded.  Your only hope is javascript (or some other client side script...vbscript, etc), and I'm pretty sure it's sandboxed so that what you are asking won't work (I could be wrong though).

No, BlueSkyIS, the uploaded file has a new mod date relative to the time it is uploaded to the server.

 

I've been thinking about this all day and had started to figure that it just wasn't possible. I just wanted to be certain i wasn't missing something. Thanks for the suggestions. I suppose I might try looking for a small javascript solution or else I can just prompt the user for the file creation information when they select the file to upload.

I kept digging around and have started wondering if PHP/CURL could be used to read the mod time of a remote file. I see the function curl_getinfo() and settings like CURLOPT_FILETIME, but I don't have any experience using them. Can someone tell me if CURL only works on on server hosted files?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.