4
I have a system where, are listed documents from the database, where the user has the option to view or download the file. I want to know how to rescue this file from the bank and force the download of it. This file is on .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);
Only he returns me the following message:
Header may not contain more than a single header, new line Detected in
Have you seen this article? http://blog.thiagobelem.net/forcando-download-de-arquivos-com-php/
– Leonardo
Yes, and I already tested that script, but it keeps returning me the same message I mentioned above
– Meeeefiu
@Mathdesigner47 since you were able to solve it and it was a very specific error, I would suggest deleting the question in this case.
– Bacco
@Bacco, I was really confusing the file name with the content. In the 'header' I was passing the contents of the file, I tried to put any name, and it worked. Problem solved!
– Meeeefiu
@Mathdesigner47 great. I still think it would be the case to delete the question, but see what you think best! The important thing is that solved.
– Bacco