Can I get the date a picture was taken from $FILES array?

Dear experts

I am working on an image file upload script that attempts to read the date the image was taken from the uploaded file array.

I found the 'filemdate' function on and attempted to use it with the following results:

With filemdate($_FILES['ImgFile'][tmp_name]) this just returns the current date (I'm guessing because it was modified when uploaded to the temp dir).

With filemdate($_FILES['ImgFile'][name] I get: 'Warning: filemtime(): Stat failed for 100_0436.jpg (errno=2 - No such file or directory)'.

Can anyone help?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

$_FILES['ImgFile'][name] is literally the filename of the file on the clients computer (so Bob.jpg)

$_FILES['ImgFile'][tmp_name] is where PHP temporarially stores the file and is going to be not very old.

If you do

$exif_data = exif_read_data ($_FILES['ImgFile'][tmp_name]);

The time the photo was taken should be stored at $exif_data['FileDateTime'] as a Unix time stamp (or it is on all my photos), but it is conceivable that this information wont exist in certain cases.  

It is also stored in $exif_data['DateTime'] as a proper date by my digital camera, BUT I found this was removed by Photoshop when saving for web, so it may not be as reliable as 'FileDateTime'.  

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JasLaneAuthor Commented:
Thanks for clearing that up CaveyCoUk. The $exif_data doesn't work in all cases but is the best fit for my problem. Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.