summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/libraries/zip.rst16
1 files changed, 13 insertions, 3 deletions
diff --git a/user_guide_src/source/libraries/zip.rst b/user_guide_src/source/libraries/zip.rst
index ea5b46bac..535aa82d9 100644
--- a/user_guide_src/source/libraries/zip.rst
+++ b/user_guide_src/source/libraries/zip.rst
@@ -98,10 +98,10 @@ Class Reference
$this->zip->add_dir('myfolder'); // Creates a directory called "myfolder"
- .. method:: read_file($path[, $preserve_filepath = FALSE])
+ .. method:: read_file($path[, $archive_filepath = FALSE])
- :param string $path: path to file
- :param bool $preserve_filepath: whether to maintain the original filepath
+ :param string $path: Path to file
+ :param mixed $archive_filepath: New file name/path (string) or (boolean) whether to maintain the original filepath
:returns: bool
Permits you to compress a file that already exists somewhere on your server.
@@ -126,6 +126,16 @@ Class Reference
In the above example, photo.jpg will be placed into the *path/to/* directory.
+ You can also specify a new name (path included) for the added file on the fly::
+
+ $path = '/path/to/photo.jpg';
+ $new_path = '/new/path/some_photo.jpg';
+
+ $this->zip->read_file($path, $new_path);
+
+ // Download ZIP archive containing /new/path/some_photo.jpg
+ $this->zip->download('my_archive.zip');
+
.. method:: read_dir($path[, $preserve_filepath = TRUE[, $root_path = NULL]])
:param string $path: path to directory