Re: TIdMultiPartFormDataStream alternative?

Giganews Newsgroups
Subject: Re: TIdMultiPartFormDataStream alternative?
Posted by:  Remy Lebeau (TeamB) (
Date: Sun, 23 Jan 2005

"Vaelek @ LifeIsHell" <val-ne…> wrote in message

> Okay, I need to post data as the content-type
> application/x-www-form-urlencoded

You are using the wrong approach then.

> However, since I'm using  TIdMultiPartFormDataStream Indy
> automatically changes the content type to multipart/form-data.

As well it should. "application/x-www-form-urlencoded" and
"multipart/form-data" handle data very differently.
TIdMultiPartFormDataStream is specifically designed for
"multipart/form-data" only.

> Is there a type that is not multi-part that I cannot seem to find?

Use a normal TStrings class to store your data, such as TStringList, and
then pass that to Post() instead of TIdMultiPartFormDataStream.

> I am needing the actual post data stream to be in the format of
> var=val&var=val&var=val like IE does.

You are using the same name for multiple values.  Which version of Indy are
you actually using?  If Indy 9, then TIdHTTP does not support multiple
values with the same name.  They won't be encoded properly.  This has been
corrected in Indy 10.




In response to

TIdMultiPartFormDataStream alternative? posted by Vaelek @ LifeIsHell on Sun, 23 Jan 2005