在上传文件之前preVIEW图片 [英] Preview Image before uploading file

查看:132
本文介绍了在上传文件之前preVIEW图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经上传的文件得到了一个问题。我创建了一个asp.net aspx文件,然后我加了一个FileUpload控件和图像控制。我想,以显示图像控制preVIEW图像上传之前。我创建了一个下面的脚本。

I have got one problem by uploading file. I created an aspx file in asp.net then I added a fileupload control and image control. I want to show preview image in image control before uploading. I created a following script.

<img id="Image" src="" alt="" />
            <br />
<asp:FileUpload ID="Upload" runat="server" onchange="document.getElementById('Image').src = 'file:///' + this.value;alert('file:///' + this.value);" />

这不是在每一个浏览器。我怎么能这样做呢?

It is not work in every browser. How could I do that?

推荐答案

您也可以使用模式弹出<一个href=\"http://stephenwalther.com/blog/archive/2011/05/09/may-2011-release-of-the-ajax-control-toolkit.aspx\"相对=nofollow> AJAX Control Toolkit的这是FileUpload控件的例子。随着一些调整,你可以修改它以满足您的需要。

You can also use Modal PopUp AJAX Control Toolkit This is an example on fileupload control. With few tweaks you can modify it to suit your need.

这篇关于在上传文件之前preVIEW图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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