this is my code on download.php :
Code: Select all
<?php
if(isset($_GET['id']))
{
include (config/config.php);
// query the server for the file
$id = $_GET['id_ficheiro'];
$query = "SELECT Ficheiro FROM ficherio WHERE id_ficheiro = '$id'";
$result = mysql_query($query) or die(mysql_error());
// define results into variables
$name=mysql_result($result,0,"Ficheiro");
$size=mysql_result($result,0,"size");
$type=mysql_result($result,0,"type");
$content=mysql_result($result,0,"content");
header("Content-disposition: attachment; filename=$Ficheiro");
header("Content-length: $size");
header("Content-type: $type");
echo $content;
mysql_close();
}
else{
die("No file ID given...");
}
?> Code: Select all
<td><a href='index.php?mod=download&id=$row->id_ficheiro'><button class='btn btn-success'> Download </button></a></td>thank you