Home > Database > Mysql Tutorial > 将图片文件以byte的形式从导数据库中

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

WBOY
Release: 2016-06-07 15:00:08
Original
1564 people have browsed it

byte[] FileByteArray = new byte[FileLength]; //图象文件临时储存Byte数组 //Stream StreamObject = UpFile.InputStream; //建立数据流对像 /////读取图象文件数据,FileByteArray为数据储存体,0为数据指针位置、FileLnegth为数据长度 //StreamObject.Rea

 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;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template