Re: Routing downloads through PHP

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

 



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


[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