Helow Download php file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shafiq2626
Forum Commoner
Posts: 88
Joined: Wed Mar 04, 2009 1:54 am
Location: Lahore
Contact:

Helow Download php file

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Helow Download php file

Post 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
}
shafiq2626
Forum Commoner
Posts: 88
Joined: Wed Mar 04, 2009 1:54 am
Location: Lahore
Contact:

Re: Helow Download php file

Post by shafiq2626 »

its ok
Post Reply