How do I specify the file to be downloaded from the database?
main.php:
include('databaseConnection.php');
$result = mysql_query("SELECT * FROM participants");
while($row = mysql_fetch_array($result)){
$download_me= $row['cv'];
echo $row['name'] . " " . $row['area_of_exp'] . " " ;
echo "<a href='download.php?file=$download_me'> cv </a>";
echo "<br />";
}
download.php (which is where the problem lies):
$file = $_GET['row["cv"]'];
header('Content-Disposition: attachment; filename="'.$file.'"');
echo $file;
I want the CV to be downloaded when the link in main.php is clicked
In the case your file is indeed in side your database you could retrieve it this way:
Main.php:
mysql & more specific version:
download.php:
Mysql & more specific:
The database layout:
http://www.sqlfiddle.com/#!2/91cb3/4
I advice you to not store the CV in your database.