
C#网络图片抓取并保存至本地的方法
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
本文介绍了如何使用C#编程语言编写代码来从互联网上获取图片,并将其下载和保存到本地计算机上的具体方法。
实例如下所示:System.Net.WebClient myWebClient = new System.Net.WebClient(); //将头像保存到服务器 string virPath = /Uploads/AppImage/ + user.Id + /; CreateDir(virPath); string fileName = Guid.NewGuid().ToString() + .png; myWebClient.DownloadFile(headimgurl, System.Web.HttpContext.Current.Server.MapPath(virPath) + fileName);
全部评论 (0)
还没有任何评论哟~


