<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>DownloadAndUpload</title>
    <link href="https://oss.tcjskd.com/delivery/upload/js/jquery.min.js">

</head>
<body>
<from id="ff" enctype="multipart/form-data" >
    <!--multiple="multiple"   可接受多个值的文件上传字段：-->
    <input id="file_one"  type="file" accept=".xls,.doc,.txt,.pdf,.png,.jpg,.mp4"  multiple="multiple" onchange="fileUpload(this.files)"/><br>
    <input type="button" value="上传">
</from>
<script src="https://oss.tcjskd.com/delivery/upload/js/jquery.min.js"></script>
<script type="text/javascript">
    var uploadData=new FormData();
    function fileUpload(files){
        //添加文件数据组
        for(var i=0;i<files.length;i++){
            uploadData.append("files", files[i]);
        }
        //添加其他参数，如需剪切图片，剪切参数(示例)
        uploadData.append("cutSize",{"height":300,"width":400});
    }
    $(function(){
        $("input:button").click(function () {
            $.ajax({
                data: uploadData,
                type: "POST",
                url: "${ctx}/multiFileUpload",
                cache: false,
                contentType: false,
                processData: false,
                success: function(data) {
                    if(data.status!=200){
                        alert("上传失败，失败信息："+data.message);
                    }
                    else{
                        alert("上传成功："+data.body);
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert("网络连接错误，服务器未响应！");
                }
            });
        });
    });
</script>
</body>
</html>