当前位置:编程学习 > C#/ASP.NET >>

ASP.NET FileUpload 选中图片文件时预览

当通过FileUpload控件选中文件后,显示预览效果。

附代码:

<dl style="margin-bottom: 4px">
                                            <dt>商品图:</dt>
                                            <dd>
                                                <div class="upload_mod">
                                                    <div class="view" id="divPreview">
                                                        <img id="PreviewImage1" runat="server" src="#" class="tenderpic" onerror="this.src='images/noimg.jpg'"
                                                            alt="" />
                                                        <br />
                                                        <input id="ImageFileUpload1" runat="server" type="file" class="input_button input_button5" />
                                                    </div>
                                                    <div class="view">
                                                        <img id="PreviewImage2" runat="server" src="#" class="tenderpic" onerror="this.src='images/noimg.jpg'"
                                                            alt="" />
                                                        <br />
                                                        <input id="ImageFileUpload2" type="file" runat="server" class="input_button input_button5" />
                                                    </div>
                                                    <div class="view">
                                                        <img id="PreviewImage3" runat="server" src="#" class="tenderpic" onerror="this.src='images/noimg.jpg'"
                                                            alt="" />
                                                        <br />
                                                        <input id="ImageFileUpload3" type="file" runat="server" class="input_button input_button5" />
                                                    </div>
                                                    <div class="view">
                                                        <img id="PreviewImage4" runat="server" src="#" class="tenderpic" onerror="this.src='images/noimg.jpg'"
                                                            alt="" />
                                                        <br />
                                                        <input id="ImageFileUpload4" type="file" runat="server" class="input_button input_button5" />
                                                    </div>
                                                    <div class="view">
                                                        <img id="PreviewImage5" runat="server" src="#" class="tenderpic" onerror="this.src='images/noimg.jpg'"
                                                            alt="" />
                                                        <br />
                                                        <input id="ImageFileUpload5" type="file" runat="server" class="input_button input_button5" />
                                                    </div>
                                                    <asp:Button ID="btnUpload" runat="server" Text="上传" OnClick="btnUpload_Click" Height="22px" />
                                                </div>
                                                <br />
                                                <label class="pl10 f99">
                                                    图片最大限制5张,图片格式必须为JPG</label>
                                            </dd>
                                        </dl>



求高手赐招。 --------------------编程问答-------------------- Refer:
http://www.cnblogs.com/insus/archive/2012/11/13/2768951.html --------------------编程问答--------------------
引用 1 楼 insus 的回复:
Refer:
http://www.cnblogs.com/insus/archive/2012/11/13/2768951.html

--------------------编程问答--------------------
引用 1 楼 insus 的回复:
Refer:
http://www.cnblogs.com/insus/archive/2012/11/13/2768951.html

--------------------编程问答-------------------- 个人觉的把本地路径赋过去就可以预览到了吧! --------------------编程问答--------------------
引用 1 楼 insus 的回复:
Refer:
http://www.cnblogs.com/insus/archive/2012/11/13/2768951.html

未能理解相关代码,望详细说明,开发环境是:Windows Server 2008+VS2008+SQL2008。
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,