function sendDownloadHeaders($filename, $filesize) { // -------------- // This function sends download headers to the browser // -------------- // ------------------------------------------------------------------------- // Global variables // ------------------------------------------------------------------------- global $net2ftp_globals; // ------------------------------------------------------------------------- // Clean the input, and encode the filename with htmlentities // ------------------------------------------------------------------------- $filename = trim($filename); $filename_html = htmlEncode3($filename); // ------------------------------------------------------------------------- // Check which is the content type and disposition // ------------------------------------------------------------------------- $content_type = getContentType($filename); $content_disposition = "attachment"; if (strpos($filename, ".zip")) { $content_disposition = "inline"; } // ------------------------------------------------------------------------- // Send the headers - Internet Explorer // From PhpMyAdmin 3.5.2.0 file core.lib.php // ------------------------------------------------------------------------- header('Expires: ' . date(DATE_RFC1123)); // rfc2616 - Section 14.21 header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 if ($net2ftp_globals["browser_agent"] == "IE") { header('Pragma: public'); } else { header('Pragma: no-cache'); // HTTP/1.0 header('Last-Modified: ' . date(DATE_RFC1123)); } header('Content-Description: File Transfer'); header('Content-Disposition: attachment; filename="' . $filename_html . '"'); header('Content-Type: ' . $content_type); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . $filesize); }
function sendDownloadHeaders($filename, $filesize) { // -------------- // This function sends download headers to the browser // -------------- // ------------------------------------------------------------------------- // Global variables // ------------------------------------------------------------------------- global $net2ftp_globals; // ------------------------------------------------------------------------- // Clean the input, and encode the filename with htmlentities // ------------------------------------------------------------------------- $filename = trim($filename); $filename_html = htmlEncode3($filename); // ------------------------------------------------------------------------- // Check which is the content type and disposition // ------------------------------------------------------------------------- $content_type = getContentType($filename); $content_disposition = "attachment"; if (strpos($filename, ".zip") !== false) { $content_disposition = "inline"; } // ------------------------------------------------------------------------- // Send the headers - Internet Explorer // From PhpMyAdmin 2.8.0.2 file export.php // ------------------------------------------------------------------------- header("Content-Type: " . $content_type); header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT"); if ($net2ftp_globals["browser_agent"] == "IE") { header("Content-Disposition: {$content_disposition}; filename=\"" . $filename_html . "\""); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); } else { // Firefox needs an asterisk to enable filenames with special characters header("Content-Disposition: {$content_disposition}; filename*=\"" . $filename_html . "\""); header("Pragma: no-cache"); } header("Content-Description: {$filename_html}"); header("Content-Length: {$filesize}"); header("Connection: close"); }