RE: [PHP] Header problem
| From: | Andrea Giammarchi | Date: | Sun, 04 Oct 2009 16:49:13 +0000 |
| Subject: | RE: [PHP] Header problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298562@lists.php.net to get a copy of this message | ||
> Header must come first (before you output anything) or you get a parse
> error
I try to better explain ...
HTTP works like this: you ask something, you receive something, html and texts are just one option.
Your example page mess up html, zip, everything, because when you download a file you still have the
rest of the page sent in the output.
A download should have ONLY file related info/headers and nothing else in the output ... echo/print
in the middle of the code before an header is an error, everything in output before an header is an
error, everything after headers that is not related to that header is an error, got my point?
To decide how a page should behave, you must be able to do not produce anything except the expected
output with expected headers, that's why I have said headers are fundamental for a response, we
cannot play with outputs however we want.
As summary, once you have created and tried a dedicated page without a single white space or print
before, during, or after the dedicated download stuff, I'll try to understand where is the
error.
Otherwise it could be everything, and I am against "magic behaviors" ... you need to
download? Well, create a file which aims id to download and nothing else, or you gonna constantly
find these kind of problems in your applications.
Regards
_________________________________________________________________
Keep your friends updated—even when you’re not signed in.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010