作者:admin 来源: 日期:2020/3/20 23:52:54 人气: 标签:
uses System.Net.HttpClient;
function DownloadFile(const URL:string; const filename:string):boolean;varms:tmemorystream;hc:thttpclient;beginms:=tmemorystream.Create;hc:= thttpclient.Create;trytryhc.Get(URL,ms);ms.SaveTofile(filename);result:=true;excepton e: Exception doApplicationShowException(e);end;finallyhc.Free;ms.Free;end;end;