PHP help needed. Script to automatically delete files if new files are added to

Filipp

New member
image gallery? I have a PHP script that allows users to upload images to their galleries, but to save space on the server, I want to limit the number of images they can upload to, for example, 10. If they upload 11th image, I want the script to automatically delete the OLDEST image from the gallery. Any Suggestions?
This would probably require a loop that will compare filemtime...
 
well i think you've already known the big picture.
for every upload check the number of files within the upload directory.
check wheter it contains more than 10.
if true then compare the timestamp of those files. get the oldest one and delete it.
 
Back
Top