At the moment of selecting a pdf, the chrome browser visualizes it well, but if I want to download it, it does not work for me, it downloads a file with the name of the page that is ver.php
index.php
var listar = function(year) {
var table = $("#dt_cliente").DataTable({
"order": [
[0, "desc"]
],
"destroy": true,
"ajax": {
"method": "POST",
"url": "inc/listar.php?anno=" + year //Año
},
"columns": [{
"data": "decreto"
}, {
"data": "anno"
}, {
"data": "materia",
"searchable": true,
"sortable": false
}, {
"data": "pdf",
"searchable": false,
"sortable": false,
"render": function(pdf) {
if (!pdf) {
return "";
} else {
return '<a href="ver.php?pdf=' + pdf + '" target="_blank"><img src="img/pdf-icon.png"> Ver decreto</a>'
}
}
}]
ver.php
<?php
header('Content-Description: File Transfer');
header("Content-type: application/pdf");
readfile('file/'.$_GET['pdf']);
?>
If I use mozilla it works very well, what can it be? Best regards
link here I try to download the pdf in Chrome