从fileuploader控件浏览后如何立即在图像控件中显示图像 [英] how to display image in image control immediately after browsing from fileuploader control

查看:94
本文介绍了从fileuploader控件浏览后如何立即在图像控件中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从文件上传器控件浏览并单击任何按钮后,立即在asp.net的图像控件中显示图像.
taht意味着当我从fileuploader浏览图像时,它立即显示在图像控件中.

i want display image in image control of asp.net immediateky after browsing from file uploader control withot any button click .
taht means when i am browse image from fileuploader it immediately display in image control

推荐答案

可以完全满足您的要求
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php / [ ^ ]
May this full fill your requirement
http://tutorialzine.com/2011/09/html5-file-upload-jquery-php/[^]


当我从fileuploader浏览图像时,它会立即显示在图像控件中
不可能.您需要一些事件来触发所选项目的显示.
when i am browse image from fileuploader it immediately display in image control
Not possible. You need some event to trigger the display of the selected item.


使用AJAX可以实现

< asp:asyncfileupload id ="AsyncFileUpload1" runat ="server" width ="200px" onclientuploadcomplete ="uploadComplete"/>

< img id ="img_display" src =" alt =" height ="50" width ="50"/>

< script type ="text/javascript">

函数uploadComplete(sender,args)
{

var imgDisplay = document.getElementById(" img_display));

imgDisplay.src ="../upload/" + args.get_fileName();

}


</script>
IT IS Possible WITH AJAX

<asp:asyncfileupload id="AsyncFileUpload1" runat="server" width="200px" onclientuploadcomplete="uploadComplete" />

<img id="img_display" src="" alt="" height="50" width="50" />

<script type="text/javascript">

function uploadComplete(sender, args)
{

var imgDisplay = document.getElementById("img_display");

imgDisplay.src = "../upload/" + args.get_fileName();

}


</script>


这篇关于从fileuploader控件浏览后如何立即在图像控件中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆