open('AddFileToZip.zip', ZipArchive::CREATE); if ($res=== TRUE) { //Add the same file with different name say, 'AddFileToZip.txt'. $zip->addFile($file,'AddFileToZip.txt'); $zip->close(); echo 'Zip file successfully created'; } else { echo 'Failed in creating zip file'; } ?>