代码如下:if (dt.Rows[0]["photo"].ToString() != "")
{
byte[] image = (byte[])(dt.Rows[0]["photo"]);
if (image.Length > 0)
{
this.Response.Clear();
this.Response.BinaryWrite(image);
this.Response.End();
}
}
{
byte[] image = (byte[])(dt.Rows[0]["photo"]);
if (image.Length > 0)
{
this.Response.Clear();
this.Response.BinaryWrite(image);
this.Response.End();
}
}
if (image.Length>0)
{
System.IO.MemoryStream ms = new MemoryStream(image);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
this.Response.Clear();
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
this.Response.End();
ms.Close();
}
byte[] image = (byte[])(dt.Rows[0]["photo"]);
if (image.Length>0)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream(image);
this.Response.ContentType = "image/Jpeg";
ms.WriteTo(this.Response.OutputStream);
ms.Close();
}
还是只在页面上输出 System.Byte[]
byte[] photo = (byte[])Reader1["userPhoto"];
if(photo.Length != 0)
Response.BinaryWrite(photo);
图片类型可保存时保存
那估计你存入数据库中时候就是这个“System.Byte[]”字符串了
这个imgType是什么?
if (image.Length > 20)
{
// 看一下 image 到底是什么:
Response.Write(System.BitConverter.ToString(image, 0, 20));
}
如上为转换结果...
图片是存在的...
刚好就是:
System.Byte[]
参考:
0x53797374656D2E427974655B5D 了,你可以打开数据库看一下就明白了。
帖子结掉了,如果你还能看到我的回复的话~
我想说谢谢你wuyi8808,分析的很透彻...