download script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

cho@
New php-forum User
New php-forum User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

download script

Postby cho@ » Tue Sep 09, 2003 12:49 am

Hi,

I have a problem with my downloading script:
in my current page I have a link like:

Code: Select all

echo "<a href='download.php?doc=$file'> $file</a><br/>";

where $file is : file.ext

and then my download page

Code: Select all

<?
$file= $HTTP_GET_VARS['doc'];
header("Content-Type: application/download\n");
header("Content-Disposition: attachment; filename=\"$file\"");
$fn = readfile('$file');
?>


But that doesnt work it gives me a file with warning inside
<br>
<b>Warning</b>: readfile("$file") - No such file or directory in <b>real path/download.php</b> on line <b>7</b><br>

Can anybody helps me

Thanks
francois

cho@
New php-forum User
New php-forum User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Postby cho@ » Tue Sep 09, 2003 2:21 am

i ve found it here

http://www.php.net/header


Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest