2 * Styling input file uploads.
5 * @link http://www.open-emr.org
6 * @author Ranganath Pathak <pathak@scrs1.org>
7 * @copyright Copyright (c) 2018 Ranganath Pathak <pathak@scrs1.org>
8 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
11 //adapted from https://www.abeautifulsite.net/whipping-file-inputs-into-shape-with-bootstrap-3
12 // We can attach the `fileselect` event to all file inputs on the page
13 $(document).on('change', ':file', function () {
15 numFiles = input.get(0).files ? input.get(0).files.length : 1,
16 label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
17 input.trigger('fileselect', [numFiles, label]);
19 // We can watch for our custom `fileselect` event like this
21 $(':file').on('fileselect', function (event, numFiles, label) {
22 var input = $(this).parents('.input-group').find(':text'),
23 log = numFiles > 1 ? numFiles + ' files selected' : label;