SS := TStringStream.Create('', TEncoding.UTF8);
HttpClient := TIdHttp.Create();
MutPartForm := TIdMultiPartFormDataStream.Create;
try
MutPartForm.AddFormField('unitCode', UnitCode);
MutPartForm.AddFormField('regCode', RegCode);
MutPartForm.AddFile('data', 'data.zip', GetMIMETypeFromFile('data.zip'));
HttpClient.Post(Url, MutPartForm, SS);
response := SS.DataString;
finally
SS.Free;
HttpClient.Free;
MutPartForm.Free;
end;
Delphi调用Http接口上传文件
最新推荐文章于 2022-05-30 15:48:31 发布