From c167f2cef36b88f0422032fbc14c40aa3bb8b163 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 2 Oct 2006 02:47:59 +0000 Subject: --- user_guide/helpers/download_helper.html | 118 ++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 user_guide/helpers/download_helper.html (limited to 'user_guide/helpers/download_helper.html') diff --git a/user_guide/helpers/download_helper.html b/user_guide/helpers/download_helper.html new file mode 100644 index 000000000..f204d4280 --- /dev/null +++ b/user_guide/helpers/download_helper.html @@ -0,0 +1,118 @@ + + + + +Code Igniter User Guide + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

Code Igniter User Guide Version 1.5.0

+
+ + + + + + + + + + +
+ + +
+ + + +
+ + +

Download Helper

+ +

The Download Helper file helps you download data to your desktop.

+ + +

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); +
+ + + + +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b