note 76850 added to function.readfile

From: Date: Thu, 02 Aug 2007 09:44:05 +0000
Subject: note 76850 added to function.readfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-129121@lists.php.net to get a copy of this message
If you use session and Secure Site(SSL- Secure Sockets Layer) to download files using PHP function readfile(), You can get an error message for Inetrnet Explorer (IE). To avoid this problem try following function. Hope it can help you. By, sohel62 at yahoo dot com. <?php session_cache_limiter('none'); //*Use before session_start() session_start(); $file = 'ASDFGgg.pdf'; _Download("files_dir/".$file, $file); function _Download($f_location,$f_name){ header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($f_location)); header('Content-Disposition: attachment; filename=' . basename($f_name)); readfile($f_location); } ?> ---- Server IP: 61.195.146.164 Probable Submitter: 210.251.252.137 ---- Manual Page -- http://www.php.net/manual/en/function.readfile.php Edit -- https://master.php.net/note/edit/76850 Del: integrated -- https://master.php.net/note/delete/76850/integrated Del: useless -- https://master.php.net/note/delete/76850/useless Del: bad code -- https://master.php.net/note/delete/76850/bad+code Del: spam -- https://master.php.net/note/delete/76850/spam Del: non-english -- https://master.php.net/note/delete/76850/non-english Del: in docs -- https://master.php.net/note/delete/76850/in+docs Del: other reasons-- https://master.php.net/note/delete/76850 Reject -- https://master.php.net/note/reject/76850 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129121) next »