note 116345 added to class.ziparchive

From: Date: Tue, 16 Dec 2014 11:46:18 +0000
Subject: note 116345 added to class.ziparchive
Groups: php.notes 
Request: Send a blank email to php-notes+get-201203@lists.php.net to get a copy of this message
A way of zipping files and downloading them thereafter: <?php $files = array('image.jpeg','text.txt','music.wav'); $zipname = 'enter_any_name_for_the_zipped_file.zip'; $zip = new ZipArchive; $zip->open($zipname, ZipArchive::CREATE); foreach ($files as $file) { $zip->addFile($file); } $zip->close(); ///Then download the zipped file. header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.$zipname); header('Content-Length: ' . filesize($zipname)); readfile($zipname); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 112.209.230.109 ---- Manual Page -- http://php.net/manual/en/class.ziparchive.php Edit -- https://master.php.net/note/edit/116345 Del: integrated -- https://master.php.net/note/delete/116345/integrated Del: useless -- https://master.php.net/note/delete/116345/useless Del: bad code -- https://master.php.net/note/delete/116345/bad+code Del: spam -- https://master.php.net/note/delete/116345/spam Del: non-english -- https://master.php.net/note/delete/116345/non-english Del: in docs -- https://master.php.net/note/delete/116345/in+docs Del: other reasons-- https://master.php.net/note/delete/116345 Reject -- https://master.php.net/note/reject/116345 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201203) next »