zoukankan      html  css  js  c++  java
  • java”伪“批量上传

    jsp页面代码

    <form method="post" action="" enctype="multipart/form-data">
            <table>
                    <tr>
                        <td align="right">
                            请选择上传的文件:
                        </td>
                        <td>
                            <input id="file" name="file" type="file" size="35">
                            <input type="button" value="添加" onclick="addRow()">
                        </td>
                    </tr>
                    <tr style="display: none;" id="myTr">
                        <td align="right">
                            请选择上传的文件:
                        </td>
                        <td>
                            <input id="file" name="file" type="file" size="35">
                            <input type="button" value="删除" onclick="delRow(this)">
                        </td>
                    </tr>    
            </table>
        </form>

    js
    <script type="text/javascript">

    function addRow()
    {
    var tr = document.getElementById("myTr");
    var con = tr.cloneNode(true);
    con.removeAttribute("style");
    tr.parentNode.insertAdjacentElement("beforeEnd",con);
    }
    function delRow(obj)
    {
    var tr=obj.parentNode.parentNode;
    tr.parentNode.removeChild(tr);
    }
    </script>

    action代码

    public class testAction{
        private File[] file;
        private String[] fileFileName;   
     //生成get set方法
    
    遍历上传
    }
  • 相关阅读:
    ASP.NET MVC学习笔记-----ActionInvoker
    quartz启动报错
    THUSC 2021 游记
    C++下随机数的生成
    友链
    memset一些技巧
    CodeForces Round #705 总结&题解
    php计算两坐标距离
    vue中使用keepAlive组件缓存遇到的坑
    vue 中 keepAlive
  • 原文地址:https://www.cnblogs.com/Nbge/p/3637708.html
Copyright © 2011-2022 走看看