Re: Unexpected newline prepended to file
- From: "Peter H. Coffin" <hellsop@xxxxxxxxxxxxx>
- Date: Tue, 24 Nov 2009 11:11:09 -0600
On Tue, 24 Nov 2009 08:47:00 -0800 (PST), C. (http://symcbean.blogspot.com/) wrote:
Hi all,
This is doing my head in!
I've got what should be a very simple script to download a file.
Actually it does lots of other things - but I can replicate the
behaviour easily using this:
<?php
header("Cache-Control: max-age=30, must-revalidate");
header("Content-Disposition: attachment; filename=
\"test.doc\"");
header("Content-Type: application/msword");
print file_get_contents('/home/colinm/msword.doc');
?>
However, MS Word reports that it is not a doc file and says I need to
install a filter. The original file IS a msword document, but the file
is somehow getting prepended with a newline character on its journey.
Which newline character? LF, CR, CRLF? What do you edit your PHP on? Is
there a line-ending on the line with ?> on it? (There shouldn't be,
FWIW. Some things will work with stuff after the > but it's not a good
idea. Make sure the cursor doesn't go anyplace after > .)
--
I still want a phone with caller-IQ.
-- Tanuki in the monastery
.
- Follow-Ups:
- Re: Unexpected newline prepended to file
- From: C. (http://symcbean.blogspot.com/)
- Re: Unexpected newline prepended to file
- References:
- Unexpected newline prepended to file
- From: C. (http://symcbean.blogspot.com/)
- Unexpected newline prepended to file
- Prev by Date: Unexpected newline prepended to file
- Next by Date: Re: Why is shared host php GID and UID the same in my PHP Script?
- Previous by thread: Unexpected newline prepended to file
- Next by thread: Re: Unexpected newline prepended to file
- Index(es):
Relevant Pages
|