Reply to Re: What function?

Your name:

Reply:


Posted by Jean-Baptiste Nizet on 10/19/07 11:42

On 19 oct, 13:07, "salonowiec" <debrza_removet...@poczta.onet.pl>
wrote:
> My very basic code is:
> <?php
> $fname='alpha.ext';
> readfile($fname);
> ?>
> Only when ext is txt I'm getting a reasonable content, otherwise there's a
> lot of bush. What function should I use to open doc, xls, pdf, gif?...
> Can you help to a supernewbie???

If what you want to do is sending a gif, jpeg, pdf file or whatever
file to the browser and the browser displays it as it would if you had
clicked on a direct link to the file, then you must send the mime type
of the file in the HTTP response:

header("Content-Type: image/gif");

for a gif file, for example.

With direct links, the web server does it automatically, but if you
want to do it in PHP, you have to do it yourself. Read the user
comments on http://www.php.net/readfile to see some examples.

JB.

[Back to original 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

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