简体   繁体   English

在ASP.NET母版页内容占位符上载之前如何预览图像

[英]How to preview image before upload on ASP.NET master page content placeholder

How do i preview image before upload on asp.net masterpage content placeholder using asp.net controls? 在使用asp.net控件上传到asp.net母版页内容占位符之前,如何预览图像? I would prefer it to be automatically displayed after choosing a image from the file upload control. 我希望从文件上传控件中选择一个图像后将其自动显示。

Here's my code: 这是我的代码:

UploadPicture.aspx UploadPicture.aspx

<asp:Content ID="Content1" ContentPlaceHolderID="content" runat="server">

<div class="container">
    <div class="row">
        <div class="col-sm-3">

            <asp:FileUpload ID="FileUpload1" runat="server"/>

            <asp:Image ID="image" runat="server"/>

            <asp:TextBox ID="textBox1" runat="server"></asp:TextBox>

            <asp:Button ID="upload" runat="server" OnClick="upload_Click" Text="Upload" />

            <asp:Label ID="lb_msg" runat="server"></asp:Label>

        </div>
    </div>
</div>

Thanks! 谢谢!

The only way to preview the image before actual post to the server is using javascript file api. 在实际发布到服务器之前预览图像的唯一方法是使用javascript文件api。 This task is not about serverside controls. 此任务与服务器端控件无关。 You can read here about js fileapi. 您可以在此处阅读有关js fileapi的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM