From:
Operating system: Windows 7
PHP version: 5.2.16
Package: PDF related
Bug Type: Bug
Bug description:Problem in download pdf files
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.
--
Edit bug report at http://bugs.php.net/bug.php?id=53576&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53576&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53576&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53576&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53576&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53576&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53576&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53576&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53576&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53576&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53576&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53576&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53576&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53576&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53576&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53576&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53576&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53576&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53576&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53576&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53576&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53576&r=mysqlcfg