Import image files from the database in byte format

Source: Internet
Author: User
Byte [] FileByteArraynewbyte [FileLength]; temporary storage of Byte array StreamStreamObjectUpFile for image files. inputStream; creates a data stream to read image file data. FileByteArray is the data storage body, 0 is the Data Pointer position, and filelne is the Data Length StreamObject. rea

Byte [] FileByteArray = new byte [FileLength]; // temporary storage of Byte Arrays for image files // Stream StreamObject = UpFile. inputStream; // set up a data stream to the image. /// read the image file data. FileByteArray is the data storage body, 0 is the Data Pointer position, and filelne.pdf is the data length. // StreamObject. rea

Byte [] FileByteArray = new byte [FileLength]; // temporary storage of Byte Arrays for image files
// Stream StreamObject = UpFile. InputStream; // create a data Stream object

//// Read image file data. FileByteArray is the data storage body, 0 is the Data Pointer position, and filelne is the data length.
// 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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.