|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-20 00:46 UTC] johannes@php.net
-Status: Open
+Status: Bogus
[2010-12-20 00:46 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 18:00:01 2025 UTC |
Description: ------------ Hi, i have a problem in downloading pdf files that is when i click the download button it just download a text file contains unreadable and unrecognizable words and numbers , so can any one help me to solve this problem; my code to download a pdf file is : Test script: --------------- $DOCUMENT_ROOT=$_SERVER['DOCUMENT_ROOT']; $root_file = "$DOCUMENT_ROOT"."mysite2/downbooks/"; $book_name = str_replace(" ","",$book_name); $down_url = $root_file.$book_name; header('Prgrama: public'); header('Content-Type: application/pdf'); header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream'); header('Content-Type: application/download'); header('Content-disposition: attachment; filename='.$book_name.";"); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($down_url)); @readfile($book_name.".pdf"); exit; Expected result: ---------------- download a pdf file Actual result: -------------- i just get a plain text file contains unreadable and unrecognizable words and numbers.