PDA

View Full Version : Syntax?



zoobie
June 7th, 2002, 06:23
I'm using:

$headers .= "Content-Type: image/gif;name=\"smiley.gif \n"

but it's coming out:

Content-Type: image/gif;name="smiley.gif

Missing the final double quotes...Can't fix

Fix?

Thx :cry2:

Btw...Just what are the \r\n used for? Thx

ansa
June 7th, 2002, 07:08
Not wanting to you seem like a complete novice, but you've pointed out the problem yourself. After smiley.gif you don't have a closing \" ;)

ansa
June 7th, 2002, 07:09
\r is a carriage return
\n is a newline (sometimes called a line feed)

unix just uses \n (i think!) and dos uses (or used to use) \r\n
so some fiddling between the two is necessary. and i thnk the mac uses something totally weird :-)

hohoho
June 7th, 2002, 07:14
try $headers .= "Content-Type: image/gif;name=\'smiley.gif'\n"

Dusty
June 7th, 2002, 10:47
Yes, to make a newline UNIX uses the newline character, \n. DOS uses a carriage return and a newline character, \r\n. Macs use just a carriage return, \r. Forget about that when sending headers, though, just stick with \n, you'll be fine.

$headers.="Content-Type: image/gif;name=\"smiley.gif\"\n";

ansa
June 7th, 2002, 11:07
Yep, you can jsut use a \n, although most (if not all) of the RFC's say you should use \r\n. But luckily for us lazy people most web servers and browsers are built to cope with either :-)