Reply to Re: How do I send HTML and a file for 'Save-As' at the same time?

Your name:

Reply:


Posted by Daedalus.OS on 10/15/47 11:17

> Dae,
>
> Without a request from the client for another 'page' won't I receive
> the 'Headers already sent' error?
>
> Eric

No. The thing here is that since you're calling it as a new page with a
<META HTTP-EQUIV="refresh"...>, the browser is actually waiting to receive a
totally new page with new headers. All what the page you call have to do is
making the file, send the proper header and the file. Since you're making it
as a Content-Disposition: attachment, the new page will not replace the
actual page in the browser but prompt to save it to disk instead.

So here is a simple view of what is happenning when a user click the link to
some_page.php:
-The browser receive the header for that page and display the page.
-Then the meta http-equiv="refresh"... attempt to refresh to file_gen.php
-The browser think he is going to another page and wait to receive the
headers
-file_gen.php create the file and then sends the headers + the file
-Browser receives the headers and see the Content-Disposition: attachment,
this mean (for the browser) do not display, prompt for download.

(This is a simplified view ... of course)

Dae

[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

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