-
-
Save rachelbaker/d8de958ff5cfe63c6d12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function zip_file() | |
{ | |
$zipFile = $this->_plugin_path . 'assets/temp_files' . date("Y-m-d-h-i-s-"). 'test.zip'; | |
$zip = new ZipArchive; | |
$opened = $zip->open($zipFile, ZIPARCHIVE::CREATE); | |
if( $opened !== true ){ | |
// return early | |
die("cannot open {$zipFile} for writing."); | |
} | |
// DO STUFF | |
$zip->close(); | |
return $zip; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I removed the logic for setting the content headers, to limit the points of failure in this method. Don't forget to re-add them once confirming the zip file is created and returning correctly.