本文整理自网络,侵删。
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 如何从一张图片中裁剪一部分距形图片另存为文件(使用canvas.copyrect)
Delphi 操作 pdf -- 使用 acrobat sdk 初探
Delphi xe5 将Delphi code从winos 迁移到ios与android
Delphi 用浏览器来显示带图片的邮件内容,图片无需保存为本地文件
更多相关阅读请进入《Delphi》频道 >>