Delphi XE8 用HttpClient下载文件


本文整理自网络,侵删。

 
uses System.Net.HttpClient;

function DownloadFile(const URL:string; const filename:string):boolean;
var
ms:tmemorystream;
hc:thttpclient;
begin
ms:=tmemorystream.Create;
hc:= thttpclient.Create;
try
try
hc.Get(URL,ms);
ms.SaveTofile(filename);
result:=true;
except
on e: Exception do
ApplicationShowException(e);
end;
finally
hc.Free;
ms.Free;
end;
end;

相关阅读 >>

Delphi idhttp友好错误信息的捕获

Delphi tms web core 从js调用pascal函数

Delphi 获取当前目录下的.txt文本不要带后缀扩展名

Delphi检查网络连接状态3种方式

Delphi实现md5算法

Delphi fmx调用jar里的java类init方法

Delphi 基础计算两数之合

Delphi 文件crc和md5校验

Delphi中如何控制webbrowser滚动条

Delphi 实现php的urlencode编码效果

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...