本文整理自网络,侵删。
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;
相关阅读 >>
更多相关阅读请进入《Delphi》频道 >>