Decoding - Parsing POST Data on Indy 9 HttpServer

Giganews Newsgroups
Subject: Decoding - Parsing POST Data on Indy 9 HttpServer
Posted by:  Mike Myers (mik…@myacd.com)
Date: Wed, 22 Sep 2004

I'm attempting to add the ability to save files to my Indy HTTPServer.
I used the TIdMultiPartFormDataStream to build a simple test client,
and the code on the Server to handle the posts looks like:

procedure HTTPCommandGet(AThread: TIdPeerThread; ARequestInfo:
TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
  ARequestInfo.PostStream.Seek(0, soFromBeginning);
  Memo.Lines.LoadFromStream(ARequestInfo.PostStream);
end;

procedure HTTPCreatePostStream(ASender: TIdPeerThread; var VPostStream:
TStream);
begin
  VPostStream := TMemoryStream.Create;
end;

The memo on the Server displays the POST Data exactly as I sent it. What I'm
looking for now is a component or class to access the Fields and FileData in
the PostStream. I was hoping TIdMultiPartFormDataStream would allow
reading in a post stream and providing access to any filedata and fields,
but
this doesn't seem to be the case.

I'm somewhat new to the Indy HTTPServer, so hopefully I'm simply overlooking
something obvious.

Thanks!
Mike

Replies