View Full Version : PHP File Functions... :S?
LMS16
07-03-2011, 09:33 AM
Hi,
Im making a script where I show all files uploaded in a directory. These files are uploaded via FTP & are not inserted into the database.
Is there a way to fetch the time & date they were uploaded via FTP & to order them alphabetically etc...?
+REP for any help.
Lew.
Trinity
07-03-2011, 12:47 PM
Use opendir() and readdir() to open the directory and get the filenames and filetypes, then use filemtime() or filectime() to get the time the files were last modified/changed. I think filectime() would be best, apparently that will just show the creation time if you're on windows.
I think.
I don't think readdir() has any way of sorting the results, so instead of echoing them all out straight away when you're looping through, just put them into an array then use sort() to put them alphabetically.
LMS16
07-03-2011, 01:40 PM
Use opendir() and readdir() to open the directory and get the filenames and filetypes, then use filemtime() or filectime() to get the time the files were last modified/changed. I think filectime() would be best, apparently that will just show the creation time if you're on windows.
I think.
I don't think readdir() has any way of sorting the results, so instead of echoing them all out straight away when you're looping through, just put them into an array then use sort() to put them alphabetically.
Thanks, I managed to get this working earlier with sort().
Lew.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.