From 1df94901f6a19ad7e297a93dea261640ec47e79f Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 27 Jun 2023 11:48:45 +0200 Subject: [PATCH] #11372 trim long file names --- pandora_console/include/functions_html.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index f3a23ce1e8..eeba4d4215 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -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]; - inputFilename.innerText = inputImage.name; + 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 .= '';