in reply to function for ZIP file creation

please refer the link Zipping the files. It helps you to solve the problem.