I see one issue from the top. You want to zip multiple files, yet the function "listFilesInDir" will only list directories since you have this check:
!is_file($myfile)
Remove the "!" and that should list files.
Secondly, your "list" that you're trying to add gets overwritten each time you loop. So in the foreach loop here:
foreach($jpglist as $key=>$fileName)
You just take that name and put it as the string $jpglist and don't do anything with it in that loop. Then, once it's done, you create the zip.
To fix this, move the code:
if(obj->create($jpglist))
and it's supporting code into the foreach() loop. So you'd have something like:
foreach($jpglist as $key=$fileName)
{
$jpglist = "upload/jpgrename/".$fileName;
if($obj->create($jpglist))
echo 'Successfully added: ' . $jpglist;
else
echo 'Error in file creation. Trying to add: ' . $jpglist;
}
Hope that helps.