Re: Posting image

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

"Alexandre" <alexandrepires20…> wrote in message

> Remy, I need do somethink like this
> 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)


In response to

Posting image posted by Alexandre on Fri, 3 Dec 2010