a.adnanbashir
01-26-2011, 01:21 PM
Dear All,
I am trying to save a byte array as an image. this byte array may be retrieved from database or it could be retrieved from fileupload control. Then I want to show this image on web page. But this image is not displayed on web page. Here is my code;
////////////
byte[] image = new byte[FileUpload1.PostedFile.ContentLength];
HttpPostedFile uploadedImage = FileUpload1.PostedFile;
MemoryStream ms = new MemoryStream(image);
System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
string path = Path.GetTempPath();
path += "chuss.png";
returnImage.Save(path, System.Drawing.Imaging.ImageFormat.Bmp);
Session["image"] = path;
this.Image1.ImageUrl = path;
//////////////////////////
Any help will be greatly appreciated.
I am trying to save a byte array as an image. this byte array may be retrieved from database or it could be retrieved from fileupload control. Then I want to show this image on web page. But this image is not displayed on web page. Here is my code;
////////////
byte[] image = new byte[FileUpload1.PostedFile.ContentLength];
HttpPostedFile uploadedImage = FileUpload1.PostedFile;
MemoryStream ms = new MemoryStream(image);
System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
string path = Path.GetTempPath();
path += "chuss.png";
returnImage.Save(path, System.Drawing.Imaging.ImageFormat.Bmp);
Session["image"] = path;
this.Image1.ImageUrl = path;
//////////////////////////
Any help will be greatly appreciated.