将图片文件以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;

posted @ 2014-05-13 15:12  码农小小强  阅读(254)  评论(0编辑  收藏  举报