0
Hello I have a Multiple file and would like to show inside it the name of the selected files, I have a code that lists the names in the console.log, more as I could add them within the input type itself?
$(".fileMultiplo").change(function() {
readURL(this);
});
function readURL(input) {
if (input.files && input.files[0]) {
for (let i = 0; i < input.files.length; i++){
console.log(input.files[i].name)
}
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-md-12 mb-3">
<div class="custom-file">
<input type="file" multiple class="custom-file-input fileMultiplo" name="uploads[]" id="customFileMultiplo"
data-toggle="tooltip" title="Selecione vários arquivos" required>
<label class="custom-file-label" for="customFile">Selecione vários arquivos</label>
<div class="invalid-feedback">
Selecione um ou mais de um arquivo
</div>
</div>
</div>
It would if I showed the names inside a span, and then reposition that span where do you want? Or necessarily it has to be in the input file?
– Guto Xavier
@Gutoxavier, today the file name and viewed inside the input file, only 1 of them, I could even show in a span, more would be inside the span and inside the input file, I appreciate the help!
– Harry