string pathUrl = "";
Stream s = null;
System.Net.HttpWebRequest request = null;
System.Net.HttpWebResponse response = null;
request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(pathUrl);
request.Timeout = 5000; // 超时时间
response = (System.Net.HttpWebResponse)request.GetResponse();
string path = "/Image/";
string pathname = path + DateTime.Now.ToString("yyyyMMddHHss") + ".png";
s = response.GetResponseStream();
var imgs = Image.FromStream(s);
imgs.Save(pathname);
s.Close();
return pathname;
获取url图片,并保存到服务器本地
最新推荐文章于 2024-08-14 11:30:00 发布