note 126929 added to ziparchive.addfile

From: Date: Wed, 16 Mar 2022 03:52:25 +0000
Subject: note 126929 added to ziparchive.addfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-217727@lists.php.net to get a copy of this message
there are some points can be more clear, it take me some time to figure out. hope it can help you. 1.use addFile() ,method to add the file with path to zip. if the directory not exist, addFile() would auto create it. <?php .... //addFile would help you create the directory named not_exist_director before add the filename.txt file. $zip->addFile($fileToAdd, '/not_exist_directory/filename.txt'); ... ?> 2. addFile() would overwrite the old file if exist in default. <?php .... //if the filename.txt is exist in the zip, addFile() would overwrite it. because the the addFile fifth param is ZipArchive::FL_OVERWRITE by default. $zip->addFile($fileToAdd, '/filename.txt'); ... ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 112.5.202.222) ---- Manual Page -- https://php.net/manual/en/ziparchive.addfile.php Edit -- https://main.php.net/note/edit/126929 Del: integrated -- https://main.php.net/note/delete/126929/integrated Del: useless -- https://main.php.net/note/delete/126929/useless Del: bad code -- https://main.php.net/note/delete/126929/bad+code Del: spam -- https://main.php.net/note/delete/126929/spam Del: non-english -- https://main.php.net/note/delete/126929/non-english Del: in docs -- https://main.php.net/note/delete/126929/in+docs Del: other reasons-- https://main.php.net/note/delete/126929 Reject -- https://main.php.net/note/reject/126929 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217727) next »