Original file datestamp in uploads

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniele Baroncelli

    Original file datestamp in uploads

    How can I get the original datestamp of uploaded files?

    The array $_FILES doesn't seem to contain the original date.


    Any solution?


    Daniele


  • d

    #2
    Re: Original file datestamp in uploads

    "Daniele Baroncelli" <ubimmc93@liber o.it> wrote in message
    news:du8ld3$2f2 $1@newsreader.m ailgate.org...[color=blue]
    > How can I get the original datestamp of uploaded files?
    >
    > The array $_FILES doesn't seem to contain the original date.
    >
    >
    > Any solution?[/color]

    The $_FILES tells you where the temp file is, so just use the filemtime() on
    that file, and that will tell you when the upload happened.
    [color=blue]
    >
    > Daniele[/color]

    Dave


    Comment

    • Kimmo Laine

      #3
      Re: Original file datestamp in uploads

      "Daniele Baroncelli" <ubimmc93@liber o.it> wrote in message
      news:du8ld3$2f2 $1@newsreader.m ailgate.org...[color=blue]
      > How can I get the original datestamp of uploaded files?
      >
      > The array $_FILES doesn't seem to contain the original date.
      >
      >
      > Any solution?
      >[/color]


      The timestamp the file had in the client machine is lost in the transfer,
      you can only get the time it arrived at the server. Only way to access
      client fielsystem would propably be ActiveX which is the
      supercalifragil isticexpialidoc ious IE implementation of
      "security-shmecurity" that in some cases actually is enabled in clients IE
      browsers. But I'm not recommending you to go that way, just live with the
      fact that you don't get the timestamp from uploaded files.

      --
      "En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
      spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)


      Comment

      • Daniele Baroncelli

        #4
        Re: Original file datestamp in uploads

        >> How can I get the original datestamp of uploaded files?[color=blue][color=green]
        >>
        >> The array $_FILES doesn't seem to contain the original date.
        >>
        >>
        >> Any solution?
        >>[/color]
        >
        >
        > The timestamp the file had in the client machine is lost in the transfer,
        > you can only get the time it arrived at the server. Only way to access
        > client fielsystem would propably be ActiveX which is the
        > supercalifragil isticexpialidoc ious IE implementation of
        > "security-shmecurity" that in some cases actually is enabled in clients IE
        > browsers. But I'm not recommending you to go that way, just live with the
        > fact that you don't get the timestamp from uploaded files.[/color]


        Pretty shit! :-(((

        Is it a lack of the PHP implementation, or a limitation of the HTTP
        protocol?

        Does anyone has an example of how I can get the timestamp of file selected
        in the upload input trough ActiveX?

        I would need to know the original timestamp, because I am building a "photo
        blog" CMS and I want to store the photos timestamp in the database.

        Any help is very welcome.


        Daniele


        Comment

        • Oli Filth

          #5
          Re: Original file datestamp in uploads


          Daniele Baroncelli wrote:[color=blue][color=green][color=darkred]
          > >> How can I get the original datestamp of uploaded files?
          > >>
          > >> The array $_FILES doesn't seem to contain the original date.
          > >>
          > >>
          > >> Any solution?
          > >>[/color]
          > >
          > >
          > > The timestamp the file had in the client machine is lost in the transfer,
          > > you can only get the time it arrived at the server. Only way to access
          > > client fielsystem would propably be ActiveX which is the
          > > supercalifragil isticexpialidoc ious IE implementation of
          > > "security-shmecurity" that in some cases actually is enabled in clients IE
          > > browsers. But I'm not recommending you to go that way, just live with the
          > > fact that you don't get the timestamp from uploaded files.[/color]
          >
          >
          > Pretty shit! :-(((
          >[/color]

          Not really - it's a security thing. In general, the server has no
          right/reason to know what time the user created the file, in the same
          way that the server has no right/reason to know what folder it was in
          on the user's computer, etc. Therefore, browsers don't send this info
          with a file upload.

          --
          Oli

          Comment

          • Daniele Baroncelli

            #6
            Re: Original file datestamp in uploads

            >> Is it a lack of the PHP implementation, or a limitation of the HTTP[color=blue][color=green]
            >> protocol?[/color]
            >
            > Not really - it's a security thing. In general, the server has no
            > right/reason to know what time the user created the file, in the same
            > way that the server has no right/reason to know what folder it was in
            > on the user's computer, etc. Therefore, browsers don't send this info
            > with a file upload.[/color]

            So, I suppose it must be a limitation of the HTTP protocol.

            Which is then the most feasible way to save the original file timestamp in
            the database of my CMS system?

            Is ActiveX the only way?
            (would anyone give me any example of that?)


            Cheers

            Daniele


            Comment

            • Juan José Gutiérrez de QuevedoPérez

              #7
              Re: Original file datestamp in uploads

              El Fri, 3 Mar 2006 14:56:10 +0100
              Daniele escribió:
              [color=blue]
              > So, I suppose it must be a limitation of the HTTP protocol.[/color]

              actually it's not a limitation, but a design decision
              [color=blue]
              > Which is then the most feasible way to save the original file
              > timestamp in the database of my CMS system?[/color]

              from my point of view you have 3 options:
              1. ask for the date in a separate field
              2. ask the people uploading to use a fixed format for the files
              (i.e. if someone took a photo on 2/2/2006 ask them to rename the file
              to 20060202.jpeg or something like that)
              3. if you just want it for photos you could look the exif headers that
              most digital cameras place on the photos they take. apart from the date
              you will get camera make & model, orientation of the file,etc...(som e
              cameras only fill some fields, but I think the date of the photo
              should be on most photos taken)
              in php this is acomplished using the exif extension, specifically the
              exif_read_data function
              (http://php.net/manual/en/function.exif-read-data.php).


              --
              Juan José Gutiérrez de Quevedo
              Director Técnico (juanjo@iteisa. com)
              ITEISA (http://www.iteisa.com)
              942544036 - 637447953

              Comment

              • Jerry Stuckle

                #8
                Re: Original file datestamp in uploads

                Daniele Baroncelli wrote:[color=blue][color=green][color=darkred]
                >>>How can I get the original datestamp of uploaded files?
                >>>
                >>>The array $_FILES doesn't seem to contain the original date.
                >>>
                >>>
                >>>Any solution?
                >>>[/color]
                >>
                >>
                >>The timestamp the file had in the client machine is lost in the transfer,
                >>you can only get the time it arrived at the server. Only way to access
                >>client fielsystem would propably be ActiveX which is the
                >>supercalifrag ilisticexpialid ocious IE implementation of
                >>"security-shmecurity" that in some cases actually is enabled in clients IE
                >>browsers. But I'm not recommending you to go that way, just live with the
                >>fact that you don't get the timestamp from uploaded files.[/color]
                >
                >
                >
                > Pretty shit! :-(((
                >
                > Is it a lack of the PHP implementation, or a limitation of the HTTP
                > protocol?
                >
                > Does anyone has an example of how I can get the timestamp of file selected
                > in the upload input trough ActiveX?
                >
                > I would need to know the original timestamp, because I am building a "photo
                > blog" CMS and I want to store the photos timestamp in the database.
                >
                > Any help is very welcome.
                >
                >
                > Daniele
                >
                >[/color]

                Who says the data of the file is the timestamp on the photo?


                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Daniele Baroncelli

                  #9
                  Re: Original file datestamp in uploads

                  > from my point of view you have 3 options:[color=blue]
                  > 1. ask for the date in a separate field
                  > 2. ask the people uploading to use a fixed format for the files
                  > (i.e. if someone took a photo on 2/2/2006 ask them to rename the file
                  > to 20060202.jpeg or something like that)
                  > 3. if you just want it for photos you could look the exif headers that
                  > most digital cameras place on the photos they take. apart from the date
                  > you will get camera make & model, orientation of the file,etc...(som e
                  > cameras only fill some fields, but I think the date of the photo
                  > should be on most photos taken)
                  > in php this is acomplished using the exif extension, specifically the
                  > exif_read_data function
                  > (http://php.net/manual/en/function.exif-read-data.php).[/color]


                  Thanks a lot!
                  I didn't know about the Exif class!
                  I am going to use that one!

                  Otherwise, I had figured out how to use the ActiveX FileSystemObjec t in
                  Javascript:

                  var fso = new ActiveXObject(" Scripting.FileS ystemObject");
                  var f = fso.GetFile(fil espec);
                  var filedate = new Date(f.DateCrea ted)

                  Thanks!

                  Daniele


                  Comment

                  Working...