I need to add a functionality that will allow users upload up to 5 images.
Each user has his own directory.
I guess I need to check directory and see how many image files already exist in this directory and put them in an array and then print out list via a loop.
I think the theory is there...
$userDir = 'johndoe';
// go through directory and put all files ending on .jpg into an array
$imgArray = array(....);
$imgCount = count($imgArray);
if ($imgCount < 5) {
echo 'You can still add '. 5 - $imgCount .' images.';
} echo {
for($i=0; $i =< $imgCount; $i++)
{
echo '<img src="$imgArray[$i]">\n';
}
}
That's all I've got so far... Shall I use something like file_exists? Need a push in the right direction.