By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 3,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

Original file datestamp in uploads

P: n/a
How can I get the original datestamp of uploaded files?

The array $_FILES doesn't seem to contain the original date.
Any solution?
Daniele
Mar 3 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
d
"Daniele Baroncelli" <ub******@libero.it> wrote in message
news:du**********@newsreader.mailgate.org...
How can I get the original datestamp of uploaded files?

The array $_FILES doesn't seem to contain the original date.
Any solution?
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.

Daniele


Dave
Mar 3 '06 #2

P: n/a
"Daniele Baroncelli" <ub******@libero.it> wrote in message
news:du**********@newsreader.mailgate.org...
How can I get the original datestamp of uploaded files?

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

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
supercalifragilisticexpialidocious 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ö
sp**@outolempi.net | Gedoon-S @ IRCnet | rot13(xv***@bhgbyrzcv.arg)
Mar 3 '06 #3

P: n/a
>> How can I get the original datestamp of uploaded files?

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

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

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
Mar 3 '06 #4

P: n/a

Daniele Baroncelli wrote:
How can I get the original datestamp of uploaded files?

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

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

Pretty shit! :-(((


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

Mar 3 '06 #5

P: n/a
>> Is it a lack of the PHP implementation, or a limitation of the HTTP
protocol?


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.


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
Mar 3 '06 #6

P: n/a
El Fri, 3 Mar 2006 14:56:10 +0100
Daniele escribió:
So, I suppose it must be a limitation of the HTTP protocol.
actually it's not a limitation, but a design decision
Which is then the most feasible way to save the original file
timestamp in the database of my CMS system?


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...(some
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 (ju****@iteisa.com)
ITEISA (http://www.iteisa.com)
942544036 - 637447953
Mar 3 '06 #7

P: n/a
Daniele Baroncelli wrote:
How can I get the original datestamp of uploaded files?

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

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


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


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.
js*******@attglobal.net
==================
Mar 3 '06 #8

P: n/a
> 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...(some
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).

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 FileSystemObject in
javascript:

var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFile(filespec);
var filedate = new Date(f.DateCreated)

Thanks!

Daniele
Mar 3 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.