首页 > 代码库 > 将图片文件以byte的形式从导数据库中

将图片文件以byte的形式从导数据库中

 byte[] FileByteArray = new byte[FileLength];  //图象文件临时储存Byte数组
                //Stream StreamObject = UpFile.InputStream;             //建立数据流对像  

                /////读取图象文件数据,FileByteArray为数据储存体,0为数据指针位置、FileLnegth为数据长度  
                //StreamObject.Read(FileByteArray, 0, FileLength);
                //StreamObject = null;
                FileStream fs = new FileStream(FullFilePath, FileMode.OpenOrCreate);
                BinaryReader rs = new BinaryReader(fs);
                FileByteArray = rs.ReadBytes(Convert.ToInt32(fs.Length));
                rs.Close();
                rs = null;
                fs.Close();
                fs = null;

                theNewFile.CONTENT = FileByteArray;