upload.html
2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!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" th:action="updateFile" method="post" enctype="multipart/form-data">
<!-- <p><input type="file" name="myfile"/></p>-->
<input class="fileUpload" type="file" id="myfile" name="myfile">
<!-- <p><input type="submit" value="上传"/></p>-->
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
//初始化fileinput
var FileInput = function () {
var oFile = new Object();
//初始化fileinput控件(第一次初始化)
oFile.Init = function(ctrlName, uploadUrl) {
var control = $('#' + ctrlName);
//初始化上传控件的样式
control.fileinput({
// theme:'fa',
language: 'zh', //设置语言
uploadUrl: uploadUrl, //上传的地址
allowedFileExtensions: ["mp4","avi","dat","3gp","mov","rmvb"], //接收的文件后缀
showUpload: true, //是否显示上传按钮
showCaption: false, //是否显示标题
browseClass: "btn btn-primary", //按钮样式
maxFileCount: 1, //表示允许同时上传的最大文件个数
enctype: 'multipart/form-data',
validateInitialCount:true,
initialPreviewAsData: true,
initialPreviewConfig: [ //回显类型配置(重要)
{
type:"video",
filetype:'video/mp4'
}
],
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}!",
uploadExtraData:function (previewId, index) { //传参
var data = {
};
return data;
}
});
//导入文件上传完成之后的事件
control.on("fileuploaded", function (event, data, previewId, index) {
});
}
return oFile;
};
//初始化fileinput
var oFileInput = new FileInput();
//参数1:控件id、参数2:上传地址
oFileInput.Init("myfile", ctx + 'manager/uploadInfo/upload/updateFile');
</script>
</body>
</html>