diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-05-11 12:41:59 +0200 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2010-05-11 12:41:59 +0200 |
commit | 26872de184e4aa2ae92bae645782089e9656115d (patch) | |
tree | f00477488791602a0f582bb8c51434e9a933087e /user_guide/libraries | |
parent | e602683aa6362e2efeb03408cea749cfeaaeef4f (diff) |
Added an option to remove the preceding trail of empty folders when creating a Zip archive.
Diffstat (limited to 'user_guide/libraries')
-rw-r--r-- | user_guide/libraries/zip.html | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html index 44603f2bc..844023b9e 100644 --- a/user_guide/libraries/zip.html +++ b/user_guide/libraries/zip.html @@ -177,7 +177,7 @@ $this->zip->download('my_backup.zip'); <h2>$this->zip->read_dir()</h2> -<p>Permits you to compress a folder (and its contents) that already exists somewhere on your server. Supply a file path to the +<p>Permits you to compress a folder (and its contents) that already exists somewhere on your server. Supply a file path to the directory and the zip class will recursively read it and recreate it as a Zip archive. All files contained within the supplied path will be encoded, as will any sub-folders contained within it. Example:</p> @@ -189,6 +189,16 @@ $this->zip->read_dir($path); $this->zip->download('my_backup.zip'); </code> +<p>By default the Zip archive will place all directories listed in the first parameter inside the zip. If you only want the end folder to be in the zip +you can pass <kbd>FALSE</kbd> (boolean) in the second parameter. Example:</p> + +<code> +$path = '/path/to/your/directory/';<br /><br /> +$this->zip->read_dir($path, FALSE); +</code> + +<p>This will create a ZIP with the folder "directory" inside, then all sub-folders stored correctly inside that.</p> + |