PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I need to write a function that reads three files (ex: txt, gif, jpg) and creates a zip file containing them. Anyone have a clue to how this can be done?
Use mkdir() to make a directory.
Use copy() to copy the files to the new directory.
You can use exec() to execute a shell command to zip the file.
Command could be something like "zip filename". Depends on your servers OS.
Currently direct compression using standard PHP libraries can be done only with bz2 - http://php.net/manual/en/ref.bzip2.php - this is OS independent.
But I guess most servers will have a zip compression tool to execute.