MultiPartFormDataStream

Giganews Newsgroups
Subject: MultiPartFormDataStream
Posted by:  Alexandre (alexandrepires20…@yahoo.com.br)
Date: Sun, 7 Aug 2011

Hi Remy,

Remy I'm trying to upload a photo on a website with
TIdMultipartFormDataStream.

Basically my code is as follows:

tidhttp.Request.ContentType :=
  MultiPartFormDataStream.RequestContentType;
MultiPartFormDataStream.AddFormField('my_parameter1', '1265453453');
MultiPartFormDataStream.AddFile('', 'c:\image.jpg',  GetMimeTypeFromFile(
'c:\image.jpg'));
MultiPartFormDataStream.Position := 0;
resultado := tidhttp.Post('http://upload.'', MultiPartFormDataStream);

When I upload through the browser output stream is something like this:

-------
Content-Disposition: form-data; name="my_parameter1"

1265453453
-------
Content-Disposition: form-data; filename="image.jpg"
Content-Type: image/jpeg

ÿØÿà

But when I upload through my proogram with Indy output stream is something
like this:

----------080711121631682
Content-Disposition: form-data; name="my_parameter1"
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

----------080711121631682
Content-Disposition: form-data; name=""; filename="image.jpg"
Content-Type: image/pjpeg
Content-Transfer-Encoding: binary

ÿØÿà

What can I do to indy strem to stay the same of browser stream ?

Thanks for some help

Replies