用IDHTTP 实现上传和返回XML
{idHTTP}
procedure upload;
vartmpWeb: TIdHTTP;
FS: TIdMultiPartFormDataStream;
begin
try
tmpWeb:=TIdHTTP.Create(nil);
FS := TIdMultiPartFormDataStream.Create;
FS.AddFormField('postconntext', ''); //上传参数
FS.AddFile('userfile', trim(filename), ''); //上传文件
url:='';
return:=tmpWeb.Post(url,FS); //tmpWeb.get(url,FS);
if return='1' then
begin
showmessage('上传成功!');
end;
finally
tmpWeb.Disconnect;
FreeAndNil(tmpWeb);
FS.Free;
end;
end;