The site: http://add.imgchan.com Script is taking images from the "up" folder. I'm trying to limit 4 images that have been recently uploaded. Also when when they click on the image, i would like them to go to the source of the image. For example the picture of the bmw. From the recently uploaded. When the click on it they would go to http://add.imgchan.com/up/a.jpg <? $files = glob("up/*.*"); for ($i=1; $i<count($files); $i++) { $num = $files[$i]; echo '<img src="'.$num.'" width="200" height="150" alt="random image">'." "; } ?> Code (markup): Please help
Hi You are trying to get the recently uploaded files. Try to give a time stamp or unique integer id. Then take the last 4 or take the latest 4 time stamp. Hope this will help you.
You could also read all finles of the folder into an array (glob do it well). Then you can do a loop and use filemtime($files[$i]) to get the modification date and save it into a temporary array. Then you sort the array, and show the 4 resutls you need.