日期:2014-05-17 浏览次数:20817 次
#region 将文件转换成流
//public byte[] SetImageToByteArray(string fileName, ref string fileSize)
/// <summary>
/// 将文件转换成流
/// </summary>
/// <param name="fileName">文件全路径</param>
/// <returns></returns>
public byte[] SetImageToByteArray(string fileName)
{
byte[] image = null;
try
{
FileStream fs = new FileStream(fileName, FileMode.Open);
FileInfo fileInfo = new FileInfo(fileName);
//fileSize = Convert.ToDecimal(fileInfo.Length / 1024).ToString("f2") + " K";
int streamLength = (int)fs.Length;
image = new byte[streamLength];
fs.Read(image, 0, streamLength);
fs.Close();
return image;
}
&nbs