note 47411 added to function.fpassthru

From: Date: Mon, 15 Nov 2004 20:45:09 +0000
Subject: note 47411 added to function.fpassthru
Groups: php.notes 
Request: Send a blank email to php-notes+get-80558@lists.php.net to get a copy of this message
The way the PHP page is generated (buffered or not, and how if buffered) has an impact of the download function made using fpassthru (or fread, ...). I mean a download function may work just fine when it is called from a simple php file (no buffering here): <?php function download($file) { ... } $filename = "/tmp/test.zip"; download($filename); ?> but may fails "in the real life" when the page is buffered: <?php ob_start("ob_gzhandler"); ... require_once(download.php); ... $filename = "/files/file.zip"; download($filename); ?> In my particular case, only Firefox 1.0 English did not perform the download, because of the ob_start("ob_gzhandler"). Replacing it by ob_start() solved the problem. Hope that helps Laurent from Paris, France ---- Manual Page -- http://www.php.net/manual/en/function.fpassthru.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47411 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47411&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47411&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80558) next »