View Full Version : Last Uploaded Pic in directory

03-04-2009, 08:30 PM
i am looking for a script that shows the latest pic uploaded in a certain directory... :confused:

can any1 plz help me???

03-04-2009, 11:50 PM
Ok, consider the following:

.......1. You cannot get directories with javascript(atleast coming from my knowledge, someone correct me if I'm wrong please).

.......2. You could do this with PHP, but get the last modified picture, not last uploaded...

03-05-2009, 05:05 AM
As long as all of the images were uploaded to the server, wouldn't last modified be the same as last uploaded?

Anyways, if you used a naming convention for the images that showed the date, javascript could do this. Like if the images were named:


for March 4th 2009. Then you could use the javascript date object to get the date and work backward until you found an image that would load as an image object. Once that was found, it could be displayed. But if you have a server side language like PHP or asp available, that would probably be a better choice, as the images could be named whatever you like, and you wouldn't have to wait for the image to load to know that it was there, and it would work even if the user had javascript off or unavailable.