When you click on a link, you would like to download a file. The file path comes from the database. The path to the download of the file is correct, something like "catalog / catalog_janeiro.pdf".
<?php
$sql = mysql_query("SELECT * FROM tbl_catalogo WHERE id = '1'");
$row = mysql_fetch_array($sql);
$catalogo = $row['link']; // CAMINHO DO FICHEIRO
header("Content-disposition: attachment; filename=$catalogo");
header("Content-type: application/pdf");
readfile("$catalogo");
?>
The link to the download:
<a href="<?php echo $catalogo;?>" target="_blank"><img src="images/catalogo.jpg" /></a>
The problem is that it gives me error in all the header lines ();
Warning: Cannot modify header information -
headers already sent by
(output started at /home/inforcyb/public_html/opaco/header.php:15)
in /home/inforcyb/public_html/opaco/index.php on line 181