Posted by mpar612 on 12/04/06 23:15
I am trying to create an area where a user can come to a page that
queries a database and displays links to files. Here is the code for
the link:
<td><a href="download.php?path=../ftp/$path&name=$name\"
target=\"_blank\">$name</a></font></b></td>
>From what I have read the purpose of download.php is to contain the
header information to download the file. This is the only code that I
have in download.php:
<?php
$file = $_GET['file'];
$name = $_GET['name'];
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$name");
?>
When I click on the original link above a window pops up with the
correct filename asking me if I want to open or save the file, but when
I save it to a disk or try opening it, I do not get the file that is on
the server. It is simply a blank file or I get an error from the
program that is trying to open the file.
What I don't understand is how does download.php know which file to
open? Am I taking the right approach to this?
Any feedback would be great. Thanks!
Navigation:
[Reply to this message]
|