Sorry i meant to put :domain.com/download.php?id=1
On the database i have changed where the file is stored.
But still not working
Im not sure whey its not working
Here is my script:
<?php
// Make a MySQL Connection
mysql_connect("localhost", "username", "Password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
// Retrieve all the data from the "example" table
$id = (int)$_GET['id'];
$result = mysql_query("SELECT * FROM download where id = $id")
or die(mysql_error());
// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
// Print out the contents of the entry
$file = $row['file_location'];
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="file.zip"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
ob_clean();
flush();
exit;
}