mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
add nicer looking file upload chooser
This commit is contained in:
parent
376477ec96
commit
315111a778
|
@ -213,6 +213,26 @@ $(document).ready( function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).ready( function() {
|
||||||
|
$(document).on('change', '.btn-file :file', function() {
|
||||||
|
var input = $(this),
|
||||||
|
numFiles = input.get(0).files ? input.get(0).files.length : 1,
|
||||||
|
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||||
|
input.trigger('fileselect', [numFiles, label]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#upload-files').on('fileselect', '.btn-file :file', function(event, numFiles, label) {
|
||||||
|
var input = $(this).parents('.input-append').find(':text'),
|
||||||
|
log = numFiles > 1 ? numFiles + ' files selected' : label;
|
||||||
|
|
||||||
|
if( input.length ) {
|
||||||
|
input.val(log);
|
||||||
|
} else {
|
||||||
|
if( log ) alert(log);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function allowDrop(ev) {
|
function allowDrop(ev) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -748,6 +748,21 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
function printFileChooser($varname='userfile', $multiple=false, $accept='') { /* {{{ */
|
||||||
|
?>
|
||||||
|
<div id="upload-files">
|
||||||
|
<div id="upload-file">
|
||||||
|
<div class="input-append">
|
||||||
|
<input type="text" class="form-control" readonly>
|
||||||
|
<span class="btn btn-default btn-file">
|
||||||
|
<?php printMLText("browse");?>… <input type="file" name="<?php echo $varname; ?>"<?php if($multiple) echo " multiple"; ?><?php if($accept) echo " accept=\"".$accept."\""; ?>>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
function printDateChooser($defDate = -1, $varName) { /* {{{ */
|
function printDateChooser($defDate = -1, $varName) { /* {{{ */
|
||||||
|
|
||||||
if ($defDate == -1)
|
if ($defDate == -1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user