摘要:ASP.NET-圖檔存在資料庫
//**檔案上傳用變數**//
System.IO.Stream stream;
System.IO.BinaryReader reader;
Byte[] bytes;
//**變數設定**//
stream = this.FileUpload1.PostedFile.InputStream;
reader = new System.IO.BinaryReader(stream);
byte = reader.ReadBytes((int)stream.Length);
//**程式轉向**//
Session["imagesByte"] = dr["image"];
this.IMG.ImageUrl = "ShowImage.aspx?rand=" + DateTime.Now.Ticks;
this.IMG.Width = 100;
//**輸出資料**//
Byte[] imagesByte = (Byte[])Session["imagesByte"];
Response.BinaryWrite(imagesByte);
Response.End();
Session["imagesByte"] = null;