Source for file download_functions.php
Documentation is available at download_functions.php
* An open source application development framework for PHP 4.3.2 or newer
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2006, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
// ------------------------------------------------------------------------
* CodeIgniter Download Helpers
* @author ExpressionEngine Dev Team
* @link http://codeigniter.com/user_guide/helpers/download_helper.html
// ------------------------------------------------------------------------
* Generates headers that force a download to happen
* @param mixed the data to be downloaded
// Try to determine if the filename includes a file extension.
// We need it in order to set the MIME type
if (FALSE ===
strpos($filename, '.'))
// Grab the file extension
// Set a default mime if we can't find it
if ( ! isset
($mimes[$extension]))
$mime =
'application/octet-stream';
$mime =
(is_array($mimes[$extension])) ?
$mimes[$extension][0] :
$mimes[$extension];
// Generate the server headers
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE"))
header('Content-Type: "'.
$mime.
'"');
header('Content-Disposition: attachment; filename="'.
basename($filename).
'"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".
$datalen);
header('Content-Type: "'.
$mime.
'"');
header('Content-Disposition: attachment; filename="'.
basename($filename).
'"');
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".
$datalen);
Documentation generated on Tue, 22 Nov 2011 13:28:55 -0200 by phpDocumentor 1.4.3