本文介绍了如何通过asp.net 2.0在图像框中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何通过asp.net 2.0在图像框中显示图像
我已经为此编写了代码...并且使用了fileuploadImage控件.
How to display image in in image box through asp.net 2.0
i have written code for it...and i use fileuploadImage control.
if (fileuploadImage.HasFile)
{
int length = fileuploadImage.PostedFile.ContentLength;
byte[] imgbyte = new byte[length];
HttpPostedFile img = fileuploadImage.PostedFile;
img.InputStream.Read(imgbyte, 0, length);
Image1.ImageUrl = Server.MapPath(fileuploadImage.FileName);
但图像不显示.请帮我...
but the image not displaying. please help me...
thanks.
推荐答案
<br />
<pre lang="cs">if (fileuploadImage.HasFile)<br />
{<br />
fileuploadImage.SaveAs(Server.MapPath("~/") + fileuploadImage.FileName);<br />
<br />
Image1.ImageUrl = "~/" + fileuploadImage.FileName;<br />
}</pre><br />
这篇关于如何通过asp.net 2.0在图像框中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!