Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Feb : Parsing multipart/form response

www.cryer.info
Managed Newsgroup Archive

Parsing multipart/form response

Subject:Parsing multipart/form response
Posted by:"Jason Smart" (jas..@ditsu.com.---)
Date:Fri, 11 Feb 2005 14:18:55

Hi

I am trying to work out how to extract from a http post call the response
which is in multipart/form style.

I can create a multipart/form style "from scratch" ok - which I also use in
the post using TIdMultiPartFormDataStream.  But is there an 'opposite'
component/class to this one?  Or do I have to write my own parser which
will, um, parse the response stream to extract out the different sections as
I need?

eg, Uploading, I do something like: (FRequestStrm =
TIdMultiPartFormDataStream)
  FRequestStrm.AddFormField('xml-rpc', <some xml text to send>);
  FRequestStrm.AddFile('binary-data', <FileNameAndPath>,
'application\data');

  Http.Post(<my server>, FRequestStrm, FResponseStrm);

If I am sending a request to my server and want to do something that is
stored in the FResponseStrm as a multipart/form style, how do I do that?  ie
my FResponseStrm (TMemoryStream) contains all the correct info, but I would
like to easily extract out the individual parts easily. Am I required to
write my own parser or can I assign my response stream to something which,
given the appropriate "fieldname" tags, will provide the information for me.

TIA

Jason

Replies:

www.cryer.info
Managed Newsgroup Archive