Hi,

I'm trying to get the creation date of a posted file.
(The file was posted thru a form).

All php functions (filemtime, fileatime etc.) on the file name are returning present time.

Anyone knows the reason ?

Here's some code:

the form:

.
<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="upload.php">
<TABLE>
<TR><TD>File</TD><TD>
<INPUT TYPE="FILE" NAME="File"></TD></TR>
</TABLE>
<INPUT TYPE="submit" VALUE="Submit"></FORM>
.

and upload.php:

.
.
$ftime = filemtime($File);
$fsize = filesize("$File");
$fd = fopen( $File, "r");
.
.
.

Thanks.

    If this is a freshly uploaded file, it's going to have a fresh timestamp. The HTTP upload method does not pass along legacy metadata such as timestamps.

      a year later

      Yeah, but let's say you need the CREATION time/date of a file? How would you get it?

      filemtime shows the modified time
      filectime shows the changed time
      fileatime shows the access time

      But there is now creation time. There's got to be a way to get that?

      Thanks,

      Ross

        PHP documentation says:

        "Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There is no creation time for Unix files in most Unix filesystems."

          Yeah, I realize that, so is there no way to read it IF it's there? I really need to do this somehow or someway.

          Plus Windows would support that (wow something Windows does better - let the flaming begin!)

          ???

          Ross

            i think php dont do this... since it is done for linukz sys first... winblows versions is a consequence.

            consider to use asp (not kidding!), if you NEED this information, take a look if it is possible..
            and dont ask me how, i do not know asp.. 🙂

              But only for an image file - you can read the exif information and get the creation date from there.

                Yeah, but I need to do this for directories and other files.

                So, no way to do it, huh???

                Ross

                  Originally posted by rosscarlson
                  Yeah, I realize that, so is there no way to read it IF it's there? I really need to do this somehow or someway.

                  Plus Windows would support that (wow something Windows does better - let the flaming begin!)

                  ???

                  Ross

                  Windows ctime is probably the same thing as Unix ctime.

                  The file you've got on your server is a different file from the one on the user's machine. It's a copy. It contains the same information, but it's on a different drive on a different computer in a different place.

                  Basically, I don't think the information you're looking for is going to exist for most file types. That's why some file formats have provision to store "Creation Date" data.

                    No, you're missing me. I posted here just to continue the discussion, but my issue is a little different.

                    I want to read the file creation time of the file that is ON the server (not remote). And yes, on Windows ctime does return change time. I just need something to return creation time.

                    So I need to be able to read the CREATION time of files and folders on the server, not remotely or anything funky like that. I only point out Windows because it does track creation time...

                    Thanks for the help though...

                    Ross

                      Write a Reply...