Page 1 of 1

Helow Download php file

Posted: Wed Mar 04, 2009 4:37 am
by shafiq2626
i have a php file and want to give facilit for clints to dwonload file.
i am using this scritp

$id =$_GET["id"];
if($id=="php")
{
header("Content-disposition: attachment; filename=aa.php");
readfile( $_SERVER['DOCUMENT_ROOT'] . "/ShoppinScript/aa.php");
}

echo "<a href='showscript.php?id=php'>Download the file to run script in your Div</a>";


/////////
to do this file download with success but the data on containing link file write in dwonloaded file.\
like i dwonload aa.php but the data of showscript.php also added in aa.php.
i need only aa.php data.
pls help me if possible.

Re: Helow Download php file

Posted: Wed Mar 04, 2009 5:09 am
by requinix
As already answered here (shafiq2626 created this thread before his question was answered):
pradeepa wrote:$id =$_GET["id"];
if($id=="php")
{
header("Content-disposition: attachment; filename=aa.php");
readfile( $_SERVER['DOCUMENT_ROOT'] . "/ShoppinScript/aa.php");
exit; //add this line it solves your problem
}

Re: Helow Download php file

Posted: Fri Mar 06, 2009 12:21 am
by shafiq2626
its ok