-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathupload.php
More file actions
executable file
·128 lines (109 loc) · 4.57 KB
/
upload.php
File metadata and controls
executable file
·128 lines (109 loc) · 4.57 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<script>
var main = function()
{
$("#upload").on('submit',function(e)
{
e.preventDefault();
$(this).ajaxSubmit(
{
beforeSend:function()
{
$("#prog").show();
$("#prog").attr('style','width: 0%');
},
uploadProgress:function(event,position,total,percentCompelete)
{
$("#prog").attr('style','width: '+percentCompelete+'%');
$("#percent").html(percentCompelete+'%');
if(percentCompelete == 100)
$("#processing").show();
else
$("#processing").hide();
},
success:function(data)
{
$("#here").html(data);
}
});
});
};
$(document).ready(main);
$(document).ready(function()
{
$("#processing").hide();
$("#cws_file").change(function()
{
$("#prog").attr('style','width: 0%');
var filename = $("#cws_file")[0].files[0].name;
$("#modal_filename").html(filename);
var extension = filename.substr((filename.lastIndexOf('.') +1)).toLowerCase();
if(extension=="cws")
{
$("#selected_filename").html(filename);
$("#submit_cws_upload").attr("class","btn btn-default");
}
else
{
$("#selected_filename").html("Selected file is not a CWS file. Please try again.");
$("#submit_cws_upload").attr("class","btn btn-default disabled");
}
});
});
</script>
<div id="here"></div>
<div class="row">
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel" style="height:600px;">
<div class="x_title">
<h3>Upload new CWS file</h3>
<div class="clearfix"></div>
</div>
<form action="handle_upload.php" method="post" enctype="multipart/form-data" id="upload">
<span class="btn btn-success btn-file">
Browse <input type="file" name="cws_file" id="cws_file">
</span>
<button type="button" data-toggle="modal" data-target=".confirm_upload_modal" class="btn btn-default disabled" id="submit_cws_upload">
<i class="fa fa-upload"></i> Upload
</button>
<!--
<button type="submit" class="btn btn-default disabled" id="submit_cws_upload">
<i class="fa fa-upload"></i> Upload
</button> -->
<p id="selected_filename"></p>
<!-- Modal for print confirmation start-->
<div class="modal fade confirm_upload_modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel2">Confirm upload</h4>
</div>
<div class="modal-body">
<h4>Are you sure you want to upload <strong id="modal_filename">this cws</strong>?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" >No</button>
<button type="submit" class="btn btn-primary" onclick="$('.modal').modal('toggle')">Yes</button>
</div>
</div>
</div>
</div>
<!-- Modal for print confirmation end -->
</form>
<div class="progress">
<div id = "prog" class="progress-bar" role="progressbar" style="width: 0%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
<br>
<div id="processing">
<strong>Processing..</strong>
<img src="img/hourglass.svg" width="30px" height="30px">
</div>
</div>
</div>
</div>
</div>