我们如何在图像框中显示该上传图像

问题描述:

先生

我在项目中上传图像,我的要求是上传后,该图像显示在图像框中,但是一旦我们单击刷新按钮而没有按下刷新,该图像就可以在解决方案资源管理器中看到.如何显示/如何刷新该解决方案以编程方式浏览器
我会等你的答复..
忠心感谢您的
m.koteswararao

sir

i am upload image in my project my requirement is after upload that image is displayed in the image box but that image is visible in solution explorer once we click the refresh button with out press the refresh how can i visible / how can we refresh that soltion explorer programatically
i will wait for your reply..
thanking you yours faithfully
m.koteswararao

您可以按照以下方式使用JavaScript

you can use javascript as per below

<script language="javascript">
var imgRe = /^.+\.(jpg|jpeg|gif|png)


/i; 函数showImage(obj) { var path = obj.value; 如果(path.search(imgRe)!= -1) { document ['image'].src ='file://'+ path; } 别的 { alert(仅限JPG,PNG和GIF!"); } } < /script > < html > < 输入 =" span> 名称 =" span> 大小 =" span> onchange =" / > < br > < img =" 图片" > < /html >
/i; function showImage(obj) { var path = obj.value; if (path.search(imgRe) != -1) { document['image'].src = 'file://'+path; } else { alert("JPG, PNG, and GIFs only!"); } } </script> <html> <input type="file" name="myImage" size="30" onchange="showImage(this)"/><br> <img name="image"/> </html>