JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<label for="file_1">Выберите файлы</label>
<input type="file" class="filescount" id="file_1" name="file_1" multiple="multiple"/>
</div>
<div>
<label for="file_2">Выберите файлы</label>
<input type="file" class="filescount" id="file_2" name="file_2" multiple="multiple"/>
</div>
CSS
label {
width: 180px;
height: 50px;
border-rdius: 4px;
text-align: center;
margin: 25px;
cursor: pointer;
display: block;
font: 14px/50px Tahoma;
transition: all 0.18s ease-in-out;
border: 1px solid #4FD666;
background: linear-gradient(to top right, #3EC97A, #69EA49 20%, rgba(255, 255, 255, 0) 80%, rgba(255, 255, 255, 0)) top right/500% 500%;
color: #4FD666;
}
label:hover {
color: white;
background-position: bottom left;
}
.filescount {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
}
JavaScript
// привет, хабр!
$(document).on('change', 'input[type=file].filescount', function() {
var text_label_id = $(this).attr('id');
var text_label = $('label[for="' + text_label_id + '"]');
if ( $(this).val() != '' ){
text_label.text( 'Выбрано файлов: ' + $(this)[0].files.length );
} else {
text_label.text( 'Выберите файлы' );
}
});