Om downloads in PHP in alle browsers beschikbaar te maken zijn nogl wat strubbelingen nodig, daarom even snel de juiste headers:
CSV:
header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($filename)));
header("Content-type: application/csv");
header("Content-Transfer-Encoding: binary");
PDF:
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header(sprintf('Content-Disposition: attachment; filename=%s', urlencode($filename)));
header('Content-Type: application/pdf');
// om ook te werken in niet-browsers zoals IE
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
Succes!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment