#11372 trim long file names

This commit is contained in:
miguel angel rasteu 2023-06-27 11:48:45 +02:00
parent 8102d6921d
commit 1df94901f6
1 changed files with 7 additions and 1 deletions

View File

@ -4831,7 +4831,13 @@ function html_print_input_file($name, $return=false, $options=false)
let inputFilename = document.getElementById("span-'.$name.'");
inputElement.addEventListener("change", ()=>{
let inputImage = document.querySelector("input[type=file]").files[0];
if (inputImage.name.length >= 45) {
let name = inputImage.name.substring(0, 20) + "..." + inputImage.name.substring((inputImage.name.length-17), inputImage.name.length);
console.log(name.length);
inputFilename.innerText = name;
} else {
inputFilename.innerText = inputImage.name;
}
});';
$output .= '</script>';