zoukankan      html  css  js  c++  java
  • 文件上传

     1        <script language="JavaScript">
     2            function addFileControl()
     3            {
     4               if( document.getElementsByName("File").length<3)//限制只能上传3个文件
     5               {
     6               var str = '<INPUT type="file" NAME="File">'
     7                document.getElementById('FileCollection').insertAdjacentHTML("beforeEnd",str)
     8               }

     9               else
    10               {
    11               document.Form1.add.disabled=true;//禁用button
    12               }

    13            }

    14    </script>
    批注:上面限制只能上传3个文件只是客户端验证,后台还需再次验证。
    HTML:

     1        <form id="Form1" method="post" runat="server" enctype="multipart/form-data">
     2            <asp:Panel ID="PanelFileManage" runat="server" Width="100%">
     3                <id="FileCollection"><INPUT type="file" name="File">&nbsp;</P>
     4                <style="COLOR: red" align="center">允许上传的类型为:ZIP,RAR,TXT,大小为1M以下</P>
     5                <align="center"><INPUT id="add" onclick="addFileControl();" type="button" value="增加(File)">
     6                    <asp:button id="Upload" Width="56px" Runat="server" Text="上传"></asp:button><INPUT style="WIDTH: 56px; HEIGHT: 24px" onclick="this.form.reset()" type="button" value="重置">
     7                </P>
     8                <align="center">
     9                    <asp:label id="strStatus" runat="server" Width="500px" BorderColor="White" BorderStyle="None"
    10                        Font-Size="9pt" Font-Bold="True" Font-Names="宋体"></asp:label></P>
    11            </asp:Panel>
    12        </form>
    原文:http://www.cnblogs.com/mgod/archive/2007/04/24/725393.html
    人的一生应该这样度过:当他回首往事的时候,不会因为虚度年华而悔恨,也不会因为碌碌无为而羞愧。
  • 相关阅读:
    准备工作
    使用awstats分析nginx日志
    kvm虚拟化环境中的时区设置
    使用awk格式化输出文本
    gitlab(7.9)升级到8.0.1
    为openstack制作CoreOS虚拟机镜像(基于CoreOS官方提供镜像)
    KVM虚拟化之嵌套虚拟化nested
    编译制作Linux 3.18内核rpm包(升级centos6.x虚拟机内核)
    Linux主机之间传输文件的几种方法对比
    spice在桌面虚拟化中的应用系列之二(Linux平台spice客户端的编译安装,支持USB映射)
  • 原文地址:https://www.cnblogs.com/htht66/p/926712.html
Copyright © 2011-2022 走看看