upload.html 1.68 KB
<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
    <th:block th:include="include :: header"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">

    <h2> 提醒:1.请用ip登录 不要用localhost 2.如果是linux环境,请确定apkpath配置好  3.如果上传了一个已经有的文件,上传将会失败</h2>
        <form class="form-signin"  method="post" enctype="multipart/form-data" id="uploadsrmFile">
            <p><input type="file" name="myfile" id="myfile"/></p>
            <p><input type="submit" value="上传"/></p>
        </form>

</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "srm/srmDetail"
    $("#uploadsrmFile").validate({
        submitHandler: function(form) {
            // console.log($('#myfile'))
            // console.log($('#myfile')[0])
            // var formdata=new FormData();
            // formdata.append('file',$('#myfile')[0].files[0]);
            var formData = new FormData();
            formData.append("myfile", document.getElementById("myfile").files[0]);
            $.ajax({
                url:prefix+'/upload/uploadFile',
                type:'post',
                contentType:false,
                processData:false,
                data: formData,
                success:function (data) {
                    console.log("============="+data)
                    if(data.code==200){
                        parent.$('#uploadfile').val(data.msg);
                        $.modal.close();
                    }
                }
            })

        }
    })

</script>
</body>
</html>