blob: df4ff7b9d9bdaeb20f5ae02c638bc99c48692b86 (
plain) (
blame)
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
|
$(document).on('change', '.btn-file :file', function() {
var input = $(this);
var numFiles = input.get(0).files ? input.get(0).files.length : 1;
var label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
input.trigger('fileselect', [numFiles, label]);
});
$(document).ready(function() {
$('.btn-file :file').on('fileselect', function(event, numFiles, label) {
var input = $(this).parents('.upload-ex').find(':text');
var log = numFiles > 1 ? numFiles + ' files selected' : label;
if (input.length) {
input.val(log);
} else {
if (log)
alert(log);
}
});
});
$('.upload-ex :text').click(function () {
$(this).parents('.upload-ex').find(':file').click();
});
|