Answer the question
In order to leave comments, you need to log in
How to limit the number of characters in a custom input type="file"?
<label class="fileBtn limit-characters form-control form-control-lg">
<input @click="currentId='file1'"
type="file"
id="file1"
v-on:change="handleFileUpload"/>
<span id="file-name">Прикрепить</span>
</label>
handleFileUpload: function (event) {
if (this.currentId === 'file') {
this.file = event.target.files[0];
document.getElementById("file-name").innerHTML = this.file.name;
}
}
Нов...файл.txt
?
Answer the question
In order to leave comments, you need to log in
methods: {
short: str => str.replace(/(?<=^.{3}).{4,}(?=.{8}$)/, '...'),
...
<span>{{ file ? short(file.name) : 'Прикрепить' }}</span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question