Posting Binary via HTTP

Giganews Newsgroups
Subject: Posting Binary via HTTP
Posted by:  Matt Saint (ma…@borer.co.uk)
Date: Mon, 1 Sep 2003

INDY 9.0.14 / D6

The following code should POST a file to the server - the server is
responding to GET's ok and POST's that use a StringList .Post
But nothing is coming through for this post code at the server end, though
no execptions are being raised.
Is there another means of posting a Binary at the HTTP Server?

if FileExists(img) then begin
      memstr:=TmemoryStream.Create;
      MemStr.LoadFromFile(img);
      if memstr.Size>0 then begin
        PostAddr:='http://'+saddr+'/SAVEIMAGE&PROJECTHANDLE='+
DBHANDLE+'&FILENAME='+ExtractFileName(img);
        StreamIN:=TStringStream.Create('');
        try
            IdHttp1.post(PostAddr,memStr,StreamIn);
        finally StreamIn.free;
        end;
      end;
      memstr.Free;
end;

Thanks

Matt

Replies