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

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.