-
Notifications
You must be signed in to change notification settings - Fork 0
/
proc.html
82 lines (65 loc) · 3.07 KB
/
proc.html
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
72
73
74
75
76
77
78
79
80
<html lang="zh-CN">
<head>
<title>导出文件上传</title>
<script src="plugin/jquery.form.js"></script>
<script src="plugin/blockUI.min.js"></script>
</head>
<body>
<h2 style="text-align: center">上传导出号码</h2>
<hr/>
<ol >
<li style="text-align: left">文件必须是txt文件</li>
<li style="text-align: left">文件格式为系统导出数据,请不要手动改变格式</li>
<li style="text-align: left">系统会自动处理重复数据</li>
</ol>
<form action="procupload.php" method="post" enctype="multipart/form-data" >
<input id="file" class="form-control input-sm " type="file" name="upfile"><br>
<button class=" btn btn-primary center-block" type="submit" >开始处理</button>
<p></p>
<div class="progress">
<div id="bar" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;">
<span id="barval">0%</span>
</div>
</div>
</form>
<textarea id="status" class="form-control" rows="6" readonly ></textarea>
<script>
(function () {
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
$('form').ajaxForm({
beforeSubmit: function () {
status.empty();
var percentVal = '0%';
$("#bar").css("width", percentVal);
var strs = new Array(); //定义一数组
var pic1 = $("#file").val();
strs = pic1.split('.');
var suffix = strs [strs.length - 1];
if (suffix != 'txt') {
alert("你选择的不是文本文件,请选择txt文件!");
$('form').clearForm();
//var obj = document.getElementById('file');
//obj.outerHTML = obj.outerHTML; //这样清空,在IE8下也能执行成功
//obj.select(); document.selection.clear(); 好像这种方法也可以清空 input file 的value值,不过我没测试
return false;
} else {
$.blockUI({message: '正在处理中,请稍候......'});
}
},
uploadProgress: function (event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
$("#bar").css("width", percentVal).find("span").html(percentVal);
//$("#barval").html(precentVal);
},
complete: function (xhr) {
$.unblockUI();
$("form").clearForm();
$("#status").html(xhr.responseText);
}
});
})();
</script>
</body>
</html>