Hello,


i am creating a simple website for a friend. There is a download page that waits 3 seconds bafore redirecting the user directly to the file. I dont want to make a redirect page for each file. so i figured i could put this in the url:

download.php?dlurl=URL OF FILE

i can do that but how would i then put it into my page as a redirect? with the variable and all?

could someone please help me a bit here?

thanks

<?php

if ($_GET['dlurl'])
{
	header('Content-type: application/pdf');
	header('Content-Disposition: attachment; filename="downloaded.pdf"');
	readfile('original.pdf');
}

?>

as an example.

thank you but that does not make sense. i want it to be automated, it shhould not matter about the file type, i just want to be able to print the text after the ?dlurl= on the page.

somebody please help

You can access the text as how Gary used it in his example. Its basically like accessing a variable you have declared only you got from the previous page.

print $_GET['dlurl'];

Is this what u were looking for? or if you want it to appear as a link on your new page

<a href="<?=$_GET['dlurl']?>" >DOWNLOAD FILE</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.