Re: Posting image

Giganews Newsgroups
Subject: Re: Posting image
Posted by:  Remy Lebeau \(Indy Team\) (re…@lebeausoftware.org)
Date: Fri, 3 Dec 2010

"Alexandre" <alexandrepires20…@yahoo.com.br> wrote in message
news:1423C14075C8E340alexandrepires20…@yahoo.com.br...

> Remy, I need do somethink like this
<snip>
> But my image is in a TMemoryStream and not in a file.
> How can do it

It depends on what version of Indy you are using.

In Indy 9 and earlier Indy 10 releases, TIdMultipartFormDataStream had an
AddObject() method, which you can pass a TStream object to, eg:

    Strm.AddObject('TheFormsFieldNameForTheFile', 'image/jpeg',
YourMemStreamHere, 'image.jpg');

In recent Indy 10 releases, AddObject() has been deprecated in favor of a
new AddFormField() overload, eg:

    Strm.AddFormField('TheFormsFieldNameForTheFile', 'image/jpeg', '',
YourMemStreamHere, 'image.jpg');

--
Remy Lebeau (Indy Team)

Replies

In response to

Posting image posted by Alexandre on Fri, 3 Dec 2010