I have a system where, documents from the database are listed, where the user has the option to view or download the file. I want to know how I can retrieve this file from the database and force it to be downloaded. This file is in .pdf
This is the code I have
header("Content-type: application/pdf");
//pega o arquivo
$sql_select_file = "SELECT * FROM malote_arq_2014 WHERE reg=" . $reg . "";
$query_select_file = mysqli_query($conn, $sql_select_file);
$result = mysqli_fetch_array($query_select_file);
header("Content-Disposition: attachment; filename=".$arquivo);
But it returns me the following message:
Header may not contain more than one header, new line detected in