-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_file_upload.html
236 lines (176 loc) · 9.2 KB
/
form_file_upload.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
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<link href="css/plugins/dropzone/basic.css" rel="stylesheet">
<link href="css/plugins/dropzone/dropzone.css" rel="stylesheet">
<link href="css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
<link href="css/plugins/codemirror/codemirror.css" rel="stylesheet">
<div class="wrapper wrapper-content animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>File inputs example</h5>
</div>
<div class="ibox-content">
The file input feature by Bootstrap and Jasny allows you to create a visually appealing file or image input widgets based on the Bootstrap style. Additional dropzone.js library gives you drag’n’drop file uploads option.
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<div class="ibox ">
<div class="ibox-title">
<h5>Input example - Bootstrap</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#" class="dropdown-item">Config option 1</a>
</li>
<li><a href="#" class="dropdown-item">Config option 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="custom-file">
<input id="logo" type="file" class="custom-file-input">
<label for="logo" class="custom-file-label">Choose file...</label>
</div>
<p class="m-t-sm">
HTML markup code for abowe example:
</p>
<textarea id="code1">
<div class="custom-file">
<input id="logo" type="file" class="custom-file-input">
<label for="logo" class="custom-file-label">Choose file...</label>
</div> </textarea>
<p class="m-t-sm">
Javascript code for abowe example:
</p>
<textarea id="code4">
$('.custom-file-input').on('change', function() {
let fileName = $(this).val().split('\\').pop();
$(this).next('.custom-file-label').addClass("selected").html(fileName);
}); </textarea>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="ibox ">
<div class="ibox-title">
<h5>Button example - Jasny</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-wrench"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a href="#" class="dropdown-item">Config option 1</a>
</li>
<li><a href="#" class="dropdown-item">Config option 2</a>
</li>
</ul>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="fileinput fileinput-new" data-provides="fileinput">
<span class="btn btn-default btn-file"><span class="fileinput-new">Select file</span><span class="fileinput-exists">Change</span><input type="file" name="..."></span>
<span class="fileinput-filename"></span>
<a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none">×</a>
</div>
<p>
HTML markup code for abowe example:
</p>
<textarea id="code2">
<div class="fileinput fileinput-new" data-provides="fileinput">
<span class="btn btn-default btn-file"><span class="fileinput-new">Select file</span>
<span class="fileinput-exists">Change</span><input type="file" name="..."/></span>
<span class="fileinput-filename"></span>
<a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none">×</a>
</div> </textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>Dropzone.js</h5>
</div>
<div class="ibox-content">
<p>
<strong>Dropzone.js</strong> is a light weight JavaScript library that turns an HTML element into a dropzone. This means that a user can drag and drop a file onto it, and the file gets uploaded to the server via AJAX.
</p>
<form action="#" class="dropzone" id="dropzoneForm">
<div class="fallback">
<input name="file" type="file" multiple />
</div>
</form>
<p class="m-t-xs">
HTML markup code for abowe example:
</p>
<textarea id="code3">
<form action="#" class="dropzone" id="dropzoneForm">
<div class="fallback">
<input name="file" type="file" multiple />
</div>
</form> </textarea>
<p class="m-t-xs">All avalible options and full documentation you can find: <a href="http://www.dropzonejs.com/#configuration-options">http://www.dropzonejs.com/#configuration-options</a> </p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<!-- Custom and plugin javascript -->
<script src="js/common.js"></script>
<!-- Jasny -->
<script src="js/plugins/jasny/jasny-bootstrap.min.js"></script>
<!-- DROPZONE -->
<script src="js/plugins/dropzone/dropzone.js"></script>
<!-- CodeMirror -->
<script src="js/plugins/codemirror/codemirror.js"></script>
<script src="js/plugins/codemirror/mode/xml/xml.js"></script>
<script>
Dropzone.options.dropzoneForm = {
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 2, // MB
dictDefaultMessage: "<strong>Drop files here or click to upload. </strong></br> (This is just a demo dropzone. Selected files are not actually uploaded.)"
};
$(document).ready(function(){
var editor_one = CodeMirror.fromTextArea(document.getElementById("code1"), {
lineNumbers: true,
matchBrackets: true
});
var editor_two = CodeMirror.fromTextArea(document.getElementById("code2"), {
lineNumbers: true,
matchBrackets: true
});
var editor_two = CodeMirror.fromTextArea(document.getElementById("code3"), {
lineNumbers: true,
matchBrackets: true
});
var editor_two = CodeMirror.fromTextArea(document.getElementById("code4"), {
lineNumbers: true,
matchBrackets: true
});
$('.custom-file-input').on('change', function() {
let fileName = $(this).val().split('\\').pop();
$(this).next('.custom-file-label').addClass("selected").html(fileName);
});
});
</script>