110,536
社区成员
发帖
与我相关
我的任务
分享
public void DownImage(string Url,string Path)
{
System.Net.WebClient web = new System.Net.WebClient();
web.DownloadFile(Url, Path);
}
new System.Net.Http.HttpClient().PostAsync().Result.Content.ReadAsByteArrayAsync()
给你举例,通过ReadAsByteArrayAsync获取所有的数据,然后通过File.WriteAllBytes写入本地文件 byte[] urlContents = client.GetByteArrayAsync(uri);
fs = new System.IO.FileStream(AppDomain.CurrentDomain.BaseDirectory + "\\images\\" + i.ToString() + ".jpg", System.IO.FileMode.CreateNew);
fs.Write(urlContents, 0, urlContents.Length);