note 105590 added to function.ziparchive-open

From: Date: Tue, 30 Aug 2011 17:06:21 +0000
Subject: note 105590 added to function.ziparchive-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-182827@lists.php.net to get a copy of this message
Most of the time people iterate over a directory with 'opendir' or 'readdir' to add files to a zip. Like... while ($file = readdir($dir)) { ... $zip->addFile($file) } Note that $zip->addFile($file) will only work in the current directory if your at the root. You will need to add the correct path to that $file string variable to have the full file name like ... $zip->addFile($dir . DIRECTORY_SEPARATOR . $file); will work. This may identify why you may get a read error when closing the file. Enjoy. ---- Server IP: 69.147.83.197 Probable Submitter: 96.20.240.164 ---- Manual Page -- http://www.php.net/manual/en/function.ziparchive-open.php Edit -- https://master.php.net/note/edit/105590 Del: integrated -- https://master.php.net/note/delete/105590/integrated Del: useless -- https://master.php.net/note/delete/105590/useless Del: bad code -- https://master.php.net/note/delete/105590/bad+code Del: spam -- https://master.php.net/note/delete/105590/spam Del: non-english -- https://master.php.net/note/delete/105590/non-english Del: in docs -- https://master.php.net/note/delete/105590/in+docs Del: other reasons-- https://master.php.net/note/delete/105590 Reject -- https://master.php.net/note/reject/105590 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182827) next »