summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/download_helper.rst
diff options
context:
space:
mode:
authorKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 21:43:25 +0200
committerKyle Farris <kylefarris@kylefarris.gotdns.org>2011-10-14 21:43:25 +0200
commitad17f4b932b3728c1e299b48f28b3ae0dbdd6b0b (patch)
treefdb357433e76000bdef60c4d18e5ab0540b07aeb /user_guide_src/source/helpers/download_helper.rst
parentdb46d02ac23b8e0bc2416e197494d3b795b57530 (diff)
parenta2125a5d830fd390b4cf35f77e9bb0558cfa2dd7 (diff)
Merged with development
Diffstat (limited to 'user_guide_src/source/helpers/download_helper.rst')
-rw-r--r--user_guide_src/source/helpers/download_helper.rst42
1 files changed, 42 insertions, 0 deletions
diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst
new file mode 100644
index 000000000..e6094dc6b
--- /dev/null
+++ b/user_guide_src/source/helpers/download_helper.rst
@@ -0,0 +1,42 @@
+###############
+Download Helper
+###############
+
+The Download Helper lets you download data to your desktop.
+
+.. contents:: Page Contents
+
+Loading this Helper
+===================
+
+This helper is loaded using the following code
+
+::
+
+ $this->load->helper('download');
+
+The following functions are available:
+
+force_download('filename', 'data')
+==================================
+
+Generates server headers which force data to be downloaded to your
+desktop. Useful with file downloads. The first parameter is the **name
+you want the downloaded file to be named**, the second parameter is the
+file data. Example
+
+::
+
+ $data = 'Here is some text!';
+ $name = 'mytext.txt';
+ force_download($name, $data);
+
+If you want to download an existing file from your server you'll need to
+read the file into a string
+
+::
+
+ $data = file_get_contents("/path/to/photo.jpg"); // Read the file's contents
+ $name = 'myphoto.jpg';
+ force_download($name, $data);
+