I am using Asp.net with C#
and back-end MySql
to keep Images as byte[] array
with using BLOB datatype
TABLE : ImageLog
ImgID int (auto increment)
ImageLogo blob
I am using following function to convert image to array...
private byte[] ConvertImageToByteArray(FileUpload fuImgToByte)
{
byte[] ImageByteArray;
try
{
MemoryStream ms = new MemoryStream(fuImgToByte.FileBytes);
ImageByteArray = ms.ToArray();
return ImageByteArray;
}
catch (Exception ex)
{
return null;
}
}
here is calling method for creating byte[] bt
to insert into MySql
Byte[] bt = null;
bt = ConvertImageToByteArray(FileUploader1); --> Passing File Uploader ControlID
inserting like...
INSERT INTO IMAGELOG (ImageLogo) VALUES ('"+bt+"')
;
Now, Program runs perfectlly without causing any errors but when image stored into MySql, it stored like System.Byte[] not into byte[] array
. Result Something like this...
ImgID ImageLogo
________________________________
1 System.Byte[] 13K ( Length ) < ----- > not storing byte[] in proper format
2 System.Byte[] 13K ( Length )
Please tell me is it in proper format ? ? or not ?? Every suggestions are welcome. Thanks in advance