RE: [PHP] Routing downloads through PHP
| From: | Shaunak Kashyap | Date: | Tue, 14 Feb 2006 22:29:13 +0000 |
| Subject: | RE: [PHP] Routing downloads through PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230392@lists.php.net to get a copy of this message | ||
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@wolphination.com]
Sent: Tuesday, February 14, 2006 1:42 PM
To: php-general@lists.php.net
Subject: Re: [PHP] 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