Re: http_download headers

From: Date: Mon, 02 Aug 2004 17:51:54 +0000
Subject: Re: http_download headers
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13938@lists.php.net to get a copy of this message
On Mon, 2 Aug 2004 17:46:03 +0200, Gema Torm <gema@autec.es> wrote: > hello, > I´m trying to use http_download, but it tells me headers are already send. > For what I´ve read, it looks like if I set setCache to false, no headers > extra sending will be done, but it doesn´t work as I expect. > I´ve tried also with staticSend. > The only way I could make it work is to insert the download code at the > beginning of the script, but I would´nt like to work this way if possible > because then all the pages in the site will go throuth this code and I only > need it in one page. > Is this possible? > headers send > html... > .... > if (!isset($_SESSION['informes']['descarrega'])){ > $_SESSION['informes']['descarrega'] = $reg_pdf->PDF; > } > else{ > $el_fitxer = $_SESSION['informes']['descarrega']; > unset($_SESSION['informes']['descarrega']); > $dl = &new HTTP_Download(); > $dl->setCache('false'); > $params = array( > 'file' => $el_fitxer, > 'contentdisposition' => array(HTTP_DOWNLOAD_ATTACHMENT, 'Asdf.doc'), > ); > $dl->staticSend($params , false); > } You're outputting something before the download code is called. Try reading this: https://www.reversefold.com/tikiwiki/tiki-index.php?page=PHPFAQs#id445791 -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin--

« previous php.pear.general (#13938) next »