5 Replies Latest reply on Jun 27, 2006 3:57 AM by Nafiganado

    CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?

    Nafiganado
      I upload file to server and I want to PRESERVE its creation date and last modified date. I read the CFFILE attributes description and expected TimeCreated and TimeLastModified would do the work.
      However, they return the date of file creation ON SERVER, because this date is really CHANGED.

      So, how can I preserve ORIGINAL dates? Is it a CF bug? Where is parameter where I could indicate that I want to preserve dates?
        • 1. Re: CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?
          LTDITADMIN
          I don't think this is possible without a Java/ActiveX. You may be able to read the file dates with JScript using the FSO object in IE and the UniversalXPConnect in Mozilla but your still going to encounter security settings issues. CF is just taking the HTTP file upload field which only sends the "Content-Type" in the header, so CF just uses the dates when the file is written to the server. You would have thought whoever designed the RFC1867 HTTP File Upload specification would have included the date created, last accessed, last modified, size, readonly and hidden file properties, well maybe in HTML 5.x.
          • 2. Re: CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?
            coderWil Level 1
            Nafigando,

            It would not be a CF bug. When the file is uploaded, there is limited information sent with it through the browser. This is a security issue between the client computer and the web server. This is limited to protect the user. The TimeCreated and TimeLastModified are for reading the dates for the file you just created on the local web browser.

            In order to do this, you would have to find a way to capture the 'lastmodifieddate' from the file before it is sent by the form, and set a form field to that date and time. Off the top of my head I could only think that VBscript 'might' be able to do it. I would research at Microsoft for a script that returns that value 'onChange'.

            Hope this helps
            • 3. CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?
              Nafiganado Level 1
              moissani,

              thanks - but I can't hope that all users' browsers have such security settings that I would be able to perform file operations on local computer - even reading. Also I try to support various versions of browsers, including Opera... It also complicates the task.

              coderWil,

              as far as I know - vbscript is supported by IE only, unlike to jscript. Moreover - anyway I would need to instanciate objects moissani has mentioned about - to get the corresponding file properties. But this is 'dead end' in common case, because of browser security settings...

              So, I make conclusion, creation date and last modified dates are sensless fields. I could use only upload date instead...
              (or make user to fill fields: file creation date, file modification date - see in file manager and retype :) ... )

              And yes, it's already high time to make http header information more extended, appending such useful things as file creation and modification dates
              • 4. CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?
                LTDITADMIN Level 1
                Nafiganado,

                I know you probably cannot use this in your application but here's something for your code vault. Also, check out "DSOleFile.PropertyReader" and "Shell.Application" for even more extended properties.

                After doing some more research on this topic, I think easiest way to do this and stay somewhat browser/platform independent is to find a Java applet that uploads files that interacts with Javascript and will return the file properties outlined in this thread. As far as security settings are concerned, if a user is uploading a file to your server, there has to be a little trust from both sides and running an applet in this sense seems trivial. Of course I don't know your application and there may be issues that rule applets out.

                I'm sure something exist, but if not, an applet can be written. If I locate anything I'll post my findings.
                • 5. Re: CFFILE doesn't PRESERVE file dates: creation and modification. Is it a CF bug?
                  Nafiganado Level 1
                  Thanks for your reply, moissani. But please, don't bother to look for - currently I've left only upload date and client was not against as yet. So let it be like it is for now...
                  As to java applet - yes, in principle it's possible to do if it's obligatory... I don't do programming in Java, but I used to write java applet for uploading files to server with resume/zipping on run feature, when I had no other way :) I signed applet by myself and it was just a dialog box for the user to accept it in order to access local files...