下载远程的文件读取到字节
/// <summary>
/// 下载远程的文件读取到字节
/// </summary>
/// <param name="uRLAddress">文件地址</param>
/// <returns></returns>
public static byte[] DownFile(string uRLAddress)
{
WebClient client = new WebClient();
byte[] mbyte = null;
Stream str = client.OpenRead(uRLAddress);
StreamReader reader = new StreamReader(str);
using (MemoryStream ms = new MemoryStream())
{
reader.BaseStream.CopyTo(ms);
mbyte = ms.ToArray();
}
reader.Close();
str.Close();
return mbyte;
}
本文来自博客园,作者:.net&new,转载请注明原文链接:https://www.cnblogs.com/wugh8726254/p/15340153.html