string rootPath = Directory.GetCurrentDirectory();
string path = rootPath + "Your File Path";
FileStream stream = new FileStream(path, FileMode.Open);
stream.Position = 0;
byte[] bytes = new byte[stream.Length];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = stream.Read(bytes, 0, bytes.Length)) > 0)
{
ms.Write(bytes, 0, read);
}
bytes = ms.ToArray();
}
|
请发表评论