RE: Routing downloads through PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try putting an ob_start(); at the top of the script. This will start
output buffering and buffer all output until the end of the script. You
can read more about ob_start() and output control in general at
http://us3.php.net/manual/en/function.ob-start.php.

Shaunak Kashyap
 
Senior Web Developer
WPT Enterprises, Inc.
5700 Wilshire Blvd., Suite 350
Los Angeles, CA 90036
 
Main: 323.330.9900
 
www.worldpokertour.com
 
Confidentiality Notice:  This e-mail transmission (and/or the 
attachments accompanying) it may contain confidential information 
belonging to the sender which is protected.  The information is 
intended only for the use of the intended recipient.  If your are not 
the intended recipient, you are hereby notified that any disclosure, 
copying, distribution or taking of any action in reliance on the 
contents of this information is prohibited. If you have received this 
transmission in error, please notify the sender by reply e-mail and 
destroy all copies of this transmission.

-----Original Message-----
From: J_K9 [mailto:lists@xxxxxxxxxxxxxxxx] 
Sent: Tuesday, February 14, 2006 1:42 PM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  Routing downloads through PHP

Hi,

Thanks for replying. Here's the code I put into download.php:

-----------------
<?

$fileid = $_GET['file_id'];

$filearray = array(
    "a0"=>"data/download1.zip",
    "a1"=>"data/download2.zip");

$location = $filearray['a'.$fileid];

if($location!='') {

    header("LOCATION: $location");

}

?>
----------------

But when I send it: http://example.com/download.php?file_id=0 , I get 
the following error-


Warning: Cannot modify header information - headers already sent by 
(output started at /public_html/download.php:6) in 
/public_html/download.php on line 18


Any idea what's going wrong?

Thanks,

J_K9


Russell Jones wrote:
> <?
> 
> $fileid = $_GET['file_id'];
> 
> $filearray = array(
>    "a0"=>"filename.zip",
>    "a1"=>"filename2.zip",
>    "a2"=>"filename3.zip");
> 
> $location = $filearray['a'.$fileid];
> 
> if($location!='') {
> 
>    header("LOCATION: $location");
> 
> }
> 
> ?>
> 
> ?>
> 
> 
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux