note 84646 added to function.ziparchive-open

From: Date: Wed, 23 Jul 2008 14:14:22 +0000
Subject: note 84646 added to function.ziparchive-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-142610@lists.php.net to get a copy of this message
The file name does not need to end in '.zip' if it is created using tempnam(). You just need to overwrite the file instead of trying to read it: $file = tempnam("tmp", "zip"); $zip = new ZipArchive(); // Zip will open and overwrite the file, rather than try to read it. $zip->open($file, ZipArchive::OVERWRITE); $zip->close(); // Stream the file to the client header("Content-Type: application/zip"); header("Content-Length: " . filesize($file)); header("Content-Disposition: attachment; filename=\"a_zip_file.zip\""); readfile($file); unlink($file); ---- Server IP: 209.41.74.194 Probable Submitter: 129.107.19.100 ---- Manual Page -- http://www.php.net/manual/en/function.ziparchive-open.php Edit -- https://master.php.net/note/edit/84646 Del: integrated -- https://master.php.net/note/delete/84646/integrated Del: useless -- https://master.php.net/note/delete/84646/useless Del: bad code -- https://master.php.net/note/delete/84646/bad+code Del: spam -- https://master.php.net/note/delete/84646/spam Del: non-english -- https://master.php.net/note/delete/84646/non-english Del: in docs -- https://master.php.net/note/delete/84646/in+docs Del: other reasons-- https://master.php.net/note/delete/84646 Reject -- https://master.php.net/note/reject/84646 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#142610) next »