Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php file upload time created

Tags:

php

I know that there is a way to get a list of file names in a folder using PHP...

but...

Is there currently any way to get the date/time the file was uploaded/created using php?

like image 571
David19801 Avatar asked May 01 '26 19:05

David19801


2 Answers

Unix does not keep track of when a file was created, only when it was changed, modified, and accessed. You can use filectime, filemtime, and fileatime, respectively to do this. If you are dealing with uploaded files, it is probably incredibly rare that you would alter the file at any time, so filemtime() is likely to give you the creation time.

like image 141
Explosion Pills Avatar answered May 03 '26 09:05

Explosion Pills


You can use the filemtime function to get the last modification time of a file and fileatime to get the access time.

like image 25
Shakti Singh Avatar answered May 03 '26 08:05

Shakti Singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!