indy multipart/form-data
uses IdMultipartFormData;
procedure TForm1.ToolButton1Click(Sender: TObject); //rest上传文件 var ms: TIdMultiPartFormDataStream; begin if OpenDialog1.Execute then begin ms := TIdMultiPartFormDataStream.Create; ms.AddFormField('filename', '中国'); ms.AddFile('file', OpenDialog1.FileName, ''); url := url + 'restupload'; IdHTTP1.Post(url, ms); ms.Free; end; end;