You are here: Re: To download a pdf file « PHP Programming Language « IT news, forums, messages
Re: To download a pdf file

Posted by Chuck Anderson on 08/17/06 20:06

Pablito wrote:
> At last I used this:
>
> <?
> $File="newspaper.pdf";
> ini_set('zlib.output_compression','Off');
> header("Pragma: public");
> header('Expires: ' . gmdate('D, d M Y H:i:s', time()+24*60*60) . ' GMT');
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: must-revalidate");
> header("Content-type: application/pdf");
> header("Content-Length: ".filesize($file));
> header("Content-disposition: inline; filename=$file");
> header("Accept-Ranges: ".filesize($file));
> readfile($file);
> exit();
> ?>
>
> that do not work like others
>
> Pablito
>
>
>
Is this still a question?

If so, here's what works for me:

header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename=' . basename($file));

readfile($file);


--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация