首页 > 其他 > 详细

下载图片

时间:2020-01-21 10:25:39      阅读:73      评论:0      收藏:0      [点我收藏+]

public static bool Down_Load_Image(string url, string filePath)
{
try
{
DateTime now_dt = DateTime.Now;
WebClient client = new WebClient();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | (SecurityProtocolType)0x300 | (SecurityProtocolType)0xc00;
//client.Proxy = null;
byte[] data = client.DownloadData(url);
FileStream fs = new FileStream(filePath, FileMode.Create);
fs.Write(data, 0, data.Length);
fs.Dispose();
fs.Close();
TimeSpan ts = DateTime.Now - now_dt;
return true;
}
catch (Exception ex)
{
return false;
}
}

下载图片

原文:https://www.cnblogs.com/niyl/p/12220683.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!