I wrote a download script that stores that file name and the file path in the database and then when someone clicks the link that goes to http://www.domain.com/index.php?download=file.zip the script checks for a file names file.zip in the database. If the file exists in the database then it gets the directory that the file is in and the name of the file and makes it equal to $_GET['download']. When I click on the download link the file does not download. Can someone help?
// This case gets teh download
generalQuery($connection, "downloads");
// get the results of the query from the session and unset the session
$result = $_SESSION['result'];
unset($_SESSION['result']);
// fetch the row
$row = @ mysql_fetch_assoc($result);
$_GET['download'] = "/downloads/" . $row["file_path"] . "/" . $row["file_name"];
$_SESSION['fileName'] = $row["file_name"];
echo $row["file_name"] . "<br>";
echo $row["file_path"] . "<br>";
This is the query.
$fileName = $_GET['download'];
// This case does the query for the pages table
$query = "SELECT * from tbl_downloads where file_name = '$fileName'";
if (!($result = @ mysql_query($query, $connection)))
showerror();
$_SESSION['result'] = array();
$_SESSION['result'] = $result;
Greg